Przeglądaj źródła

Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

Laurent Destailleur 10 lat temu
rodzic
commit
1df1a0cd2a
100 zmienionych plików z 1531 dodań i 776 usunięć
  1. 27 10
      ChangeLog
  2. 2 2
      build/makepack-dolibarr.pl
  3. 5 0
      dev/codesniffer/ruleset.xml
  4. 351 294
      dev/skeletons/skeleton_class.class.php
  5. 2 0
      htdocs/adherents/canvas/actions_adherentcard_common.class.php
  6. 0 1
      htdocs/adherents/class/adherent_type.class.php
  7. 11 0
      htdocs/admin/company.php
  8. 32 30
      htdocs/api/class/api.class.php
  9. 20 22
      htdocs/api/class/api_access.class.php
  10. 10 0
      htdocs/categories/class/categorie.class.php
  11. 12 12
      htdocs/comm/action/card.php
  12. 10 1
      htdocs/comm/action/class/actioncomm.class.php
  13. 2 2
      htdocs/comm/action/document.php
  14. 98 14
      htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
  15. 1 1
      htdocs/comm/card.php
  16. 24 1
      htdocs/comm/mailing/class/mailing.class.php
  17. 89 30
      htdocs/comm/propal/class/propal.class.php
  18. 1 0
      htdocs/comm/propal/document.php
  19. 3 2
      htdocs/comm/propal/note.php
  20. 11 9
      htdocs/comm/prospect/list.php
  21. 1 1
      htdocs/commande/apercu.php
  22. 34 14
      htdocs/commande/class/commande.class.php
  23. 6 0
      htdocs/compta/bank/class/account.class.php
  24. 5 1
      htdocs/compta/deplacement/class/deplacement.class.php
  25. 30 7
      htdocs/compta/facture/class/facture.class.php
  26. 1 0
      htdocs/compta/facture/document.php
  27. 2 1
      htdocs/compta/facture/prelevement.php
  28. 10 1
      htdocs/compta/paiement/class/paiement.class.php
  29. 5 0
      htdocs/compta/sociales/class/paymentsocialcontribution.class.php
  30. 2 0
      htdocs/contact/canvas/actions_contactcard_common.class.php
  31. 10 8
      htdocs/contact/card.php
  32. 20 4
      htdocs/contact/class/contact.class.php
  33. 2 1
      htdocs/contact/document.php
  34. 5 0
      htdocs/contrat/class/contrat.class.php
  35. 1 0
      htdocs/core/class/commondocgenerator.class.php
  36. 36 14
      htdocs/core/class/commonobject.class.php
  37. 1 0
      htdocs/core/class/commonobjectline.class.php
  38. 4 0
      htdocs/core/class/commonorder.class.php
  39. 37 20
      htdocs/core/class/html.form.class.php
  40. 1 0
      htdocs/core/class/html.formcompany.class.php
  41. 6 1
      htdocs/core/class/html.formfile.class.php
  42. 10 1
      htdocs/core/class/html.formmail.class.php
  43. 6 0
      htdocs/core/class/html.formother.class.php
  44. 1 0
      htdocs/core/class/translate.class.php
  45. 3 3
      htdocs/core/lib/date.lib.php
  46. 5 6
      htdocs/core/lib/donation.lib.php
  47. 42 4
      htdocs/core/lib/functions.lib.php
  48. 2 0
      htdocs/core/lib/json.lib.php
  49. 2 2
      htdocs/core/menus/init_menu_auguria.sql
  50. 2 2
      htdocs/core/menus/standard/eldy.lib.php
  51. 1 0
      htdocs/core/modules/DolibarrModules.class.php
  52. 4 1
      htdocs/core/modules/askpricesupplier/modules_askpricesupplier.php
  53. 3 0
      htdocs/core/modules/commande/modules_commande.php
  54. 3 0
      htdocs/core/modules/contract/modules_contract.php
  55. 7 7
      htdocs/core/modules/dons/html_cerfafr.modules.php
  56. 3 0
      htdocs/core/modules/expedition/modules_expedition.php
  57. 3 0
      htdocs/core/modules/facture/modules_facture.php
  58. 3 0
      htdocs/core/modules/livraison/modules_livraison.php
  59. 5 0
      htdocs/core/modules/mailings/fraise.modules.php
  60. 1 2
      htdocs/core/modules/modCategorie.class.php
  61. 3 0
      htdocs/core/modules/project/modules_project.php
  62. 3 0
      htdocs/core/modules/project/task/modules_task.php
  63. 3 0
      htdocs/core/modules/propale/modules_propale.php
  64. 3 0
      htdocs/core/modules/supplier_order/modules_commandefournisseur.php
  65. 2 1
      htdocs/core/triggers/dolibarrtriggers.class.php
  66. 5 0
      htdocs/don/class/don.class.php
  67. 7 1
      htdocs/don/class/paymentdonation.class.php
  68. 42 8
      htdocs/expedition/class/expedition.class.php
  69. 2 1
      htdocs/expedition/tpl/linkedobjectblock.tpl.php
  70. 11 16
      htdocs/filefunc.inc.php
  71. 8 1
      htdocs/fourn/class/fournisseur.commande.class.php
  72. 24 8
      htdocs/fourn/class/fournisseur.facture.class.php
  73. 8 2
      htdocs/fourn/class/fournisseur.product.class.php
  74. 2 1
      htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php
  75. 10 1
      htdocs/fourn/facture/card.php
  76. 2 1
      htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
  77. 4 0
      htdocs/holiday/class/holiday.class.php
  78. 33 32
      htdocs/install/mysql/migration/3.6.0-3.7.0.sql
  79. 6 4
      htdocs/install/upgrade2.php
  80. 4 3
      htdocs/langs/en_US/admin.lang
  81. 4 4
      htdocs/langs/en_US/companies.lang
  82. 18 3
      htdocs/livraison/class/livraison.class.php
  83. 6 0
      htdocs/loan/class/paymentloan.class.php
  84. 5 0
      htdocs/opensurvey/class/opensurveysondage.class.php
  85. 32 8
      htdocs/product/class/product.class.php
  86. 18 18
      htdocs/projet/card.php
  87. 28 1
      htdocs/projet/class/project.class.php
  88. 3 2
      htdocs/projet/tasks/task.php
  89. 7 7
      htdocs/public/api/index.php
  90. 2 2
      htdocs/public/test/test_forms.php
  91. 2 2
      htdocs/resource/class/resource.class.php
  92. 2 0
      htdocs/societe/canvas/actions_card_common.class.php
  93. 1 1
      htdocs/societe/class/client.class.php
  94. 6 1
      htdocs/societe/class/societe.class.php
  95. 120 108
      htdocs/societe/soc.php
  96. BIN
      htdocs/theme/common/logo_cerfa.png
  97. BIN
      htdocs/theme/eldy/img/info_black.png
  98. 44 4
      htdocs/theme/eldy/style.css.php
  99. 10 2
      htdocs/user/class/user.class.php
  100. 5 1
      htdocs/user/class/usergroup.class.php

+ 27 - 10
ChangeLog

@@ -43,14 +43,31 @@ Dolibarr better:
 - All fields "fk_societe" were renamed into "fk_soc".
 
 ***** ChangeLog for 3.7.1 compared to 3.7.* *****
-- Fix: Bug in the new photo system
-- Fix: Error management
-- Fix: [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error
-- Fix: [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe
-
-- Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose 
-  your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to
-  restore old path.
+FIX Bug in the new photo system
+FIX Error management
+FIX [ Bug #2714 ] Members -> Memberxy-> Agenda -> technical Error
+FIX [ Bug #2713 ] 3.7.0 mailing-unsubscribe.php not unsubscribe
+FIX #2901
+FIX when we create an agenda event with "Not applicable" status, it is automatically saved with "To do" status
+FIX check the user status during authentication
+FIX top links menu have target attribute with wrong value
+FIX extrafields required on thirdparty
+FIX create contact with extrafield is null when it is require
+FIX width multiselect
+FIX "script" tag with wrong syntax
+Fix bug debian 786479
+FIX update usergroup name
+Fix facturestats was not filtering on invoice type
+FIX #2856 : Wrong table design
+FIX button create payment hide if tax amount is less than 1
+FIX event for restricted user was restricted if company null
+FIX send mail, copy sendto don't read the list of contact
+FIX Properly escape untrusted data to prevent HTML injection.
+FIX send mail, copy sendto don't read the list of contact
+
+Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose 
+your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to
+restore old path.
 
 WARNING: 
 
@@ -236,8 +253,8 @@ Dolibarr better:
 - Table llx_c_pays were renamed into llx_c_country.  
 - Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after 
   creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead.
-- A lot of pages called fiche.php were renamed into card.php
-- A lot of pages called liste.php were renamed into list.php
+- A lot of pages named fiche.php were renamed into card.php
+- A lot of pages named liste.php were renamed into list.php
 - If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the
   warehouse module and your Point Of Sale module setup if you use one.
 - Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it.

+ 2 - 2
build/makepack-dolibarr.pl

@@ -982,10 +982,10 @@ if ($nboftargetok) {
 			mkdir($DESTI.'/package_windows');
 			if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } 
 
-     		print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n";
+     		print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n";
     		unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
  
- 			print "Check that in your Wine setup, you create a Z: drive that point to your /tmp directory.\n";
+ 			print "Check that in your Wine setup, you create a Z: drive that point to your / directory.\n";
 
  			$SOURCEBACK=$SOURCE;
  			$SOURCEBACK =~ s/\//\\/g;

+ 5 - 0
dev/codesniffer/ruleset.xml

@@ -350,6 +350,11 @@
 	</rule>
 	<rule ref="PEAR.NamingConventions.ValidVariableName" />
 
+	<!-- This is not in PSR2 -->
+	<rule ref="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore">
+        <severity>0</severity>
+    </rule>
+	
 	<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
 
 	<!-- Need to be commented to be disabled

+ 351 - 294
dev/skeletons/skeleton_class.class.php

@@ -1,7 +1,8 @@
 <?php
-/* Copyright (C) 2007-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es>
- * Copyright (C) 2015	   Florian Henry		<florian.henry@open-concept.pro>
+/* Copyright (C) 2007-2012  Laurent Destailleur <eldy@users.sourceforge.net>
+ * Copyright (C) 2014       Juanjo Menent       <jmenent@2byte.es>
+ * Copyright (C) 2015       Florian Henry       <florian.henry@open-concept.pro>
+ * Copyright (C) 2015       Raphaël Doursenaud  <rdoursenaud@gpcsolutions.fr>
  * Copyright (C) ---Put here your own copyright and developer email---
  *
  * This program is free software; you can redistribute it and/or modify
@@ -19,407 +20,463 @@
  */
 
 /**
- *  \file       dev/skeletons/skeleton_class.class.php
- *  \ingroup    mymodule othermodule1 othermodule2
- *  \brief      This file is an example for a CRUD class file (Create/Read/Update/Delete)
- *				Put here some comments
+ * \file    dev/skeletons/skeleton_class.class.php
+ * \ingroup mymodule othermodule1 othermodule2
+ * \brief   This file is an example for a CRUD class file (Create/Read/Update/Delete)
+ *          Put some comments here
  */
 
 // Put here all includes required by your class file
-require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
-//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
-//require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
-
+require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
+//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
+//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
 
 /**
- *	Put here description of your class
+ * Class Skeleton_Class
+ *
+ * Put here description of your class
  */
 class Skeleton_Class extends CommonObject
 {
-	var $db;							//!< To store db handler
-	var $error;							//!< To return error code (or message)
-	var $errors=array();				//!< To return several error codes (or messages)
-	var $element='skeleton';			//!< Id that identify managed objects
-	var $table_element='skeleton';		//!< Name of table without prefix where object is stored
+	/**
+	 * @var DoliDb Database handler
+	 */
+	protected $db;
+
+	/**
+	 * @var string Error code (or message)
+	 * @deprecated
+	 * @see Skeleton_Class::errors
+	 */
+	public $error;
+	/**
+	 * @var string[] Error codes (or messages)
+	 */
+	public $errors = array();
+	/**
+	 * @var string Id to identify managed objects
+	 */
+	public $element = 'skeleton';
+	/**
+	 * @var string Name of table without prefix where object is stored
+	 */
+	public $table_element = 'skeleton';
 
-	var $lines=array();
+	/**
+	 * @var Skeleton_ClassLine[] Lines
+	 */
+	public $lines = array();
 
-    var $id;
-    var $prop1;
-    var $prop2;
+	/**
+	 * @var int ID
+	 */
+	public $id;
+	/**
+	 * @var mixed Sample property 1
+	 */
+	public $prop1;
+	/**
+	 * @var mixed Sample property 2
+	 */
+	public $prop2;
 	//...
 
+	/**
+	 * Constructor
+	 *
+	 * @param DoliDb $db Database handler
+	 */
+	public function __construct( DoliDB $db )
+	{
+		$this->db = $db;
+
+		return 1;
+	}
+
+	/**
+	 * Create object into database
+	 *
+	 * @param  User $user      User that creates
+	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
+	 *
+	 * @return int <0 if KO, Id of created object if OK
+	 */
+	public function create( User $user, $notrigger = false )
+	{
+		dol_syslog( __METHOD__, LOG_DEBUG );
 
-    /**
-     *  Constructor
-     *
-     *  @param	DoliDb		$db      Database handler
-     */
-    function __construct($db)
-    {
-        $this->db = $db;
-        return 1;
-    }
-
-
-    /**
-     *  Create object into database
-     *
-     *  @param	User	$user        User that creates
-     *  @param  int		$notrigger   0=launch triggers after, 1=disable triggers
-     *  @return int      		   	 <0 if KO, Id of created object if OK
-     */
-    function create($user, $notrigger=0)
-    {
-    	global $conf, $langs;
-		$error=0;
+		$error = 0;
 
 		// Clean parameters
-        if (isset($this->prop1)) $this->prop1=trim($this->prop1);
-        if (isset($this->prop2)) $this->prop2=trim($this->prop2);
+		if (isset( $this->prop1 )) {
+			$this->prop1 = trim( $this->prop1 );
+		}
+		if (isset( $this->prop2 )) {
+			$this->prop2 = trim( $this->prop2 );
+		}
 		//...
 
 		// Check parameters
 		// Put here code to add control on parameters values
 
-        // Insert request
-		$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."(";
-		$sql.= " field1,";
-		$sql.= " field2";
+		// Insert request
+		$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
+		$sql .= ' field1,';
+		$sql .= ' field2';
 		//...
-        $sql.= ") VALUES (";
-        $sql.= " '".$this->prop1."',";
-        $sql.= " '".$this->prop2."'";
+		$sql .= ') VALUES (';
+		$sql .= ' \'' . $this->prop1 . '\',';
+		$sql .= ' \'' . $this->prop2 . '\'';
 		//...
-		$sql.= ")";
+		$sql .= ')';
 
 		$this->db->begin();
 
-	   	dol_syslog(__METHOD__, LOG_DEBUG);
-        $resql=$this->db->query($sql);
-    	if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+		$resql = $this->db->query( $sql );
+		if (!$resql) {
+			$error ++;
+			$this->errors[] = 'Error ' . $this->db->lasterror();
+			dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
+		}
 
-		if (! $error)
-        {
-            $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
+		if (!$error) {
+			$this->id = $this->db->last_insert_id( MAIN_DB_PREFIX . $this->table_element );
 
-			if (! $notrigger)
-			{
-	            // Uncomment this and change MYOBJECT to your own tag if you
-	            // want this action to call a trigger.
+			if (!$notrigger) {
+				// Uncomment this and change MYOBJECT to your own tag if you
+				// want this action to call a trigger.
 
-	            //// Call triggers
-	            //$result=$this->call_trigger('MYOBJECT_CREATE',$user);
-	            //if ($result < 0) $error++;
-	            //// End call triggers
+				//// Call triggers
+				//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
+				//if ($result < 0) $error++;
+				//// End call triggers
 			}
-        }
+		}
 
-        // Commit or rollback
-        if ($error)
-		{
+		// Commit or rollback
+		if ($error) {
 			$this->db->rollback();
-			return -1*$error;
-		}
-		else
-		{
+
+			return - 1 * $error;
+		} else {
 			$this->db->commit();
-            return $this->id;
+
+			return $this->id;
 		}
-    }
-
-
-    /**
-     *  Load object in memory from the database
-     *
-     *  @param	int		$id    	Id object
-     *  @param	string	$ref	Ref
-     *  @return int          	<0 if KO, 0 if not found, >0 if OK
-     */
-    function fetch($id,$ref='')
-    {
-    	global $langs;
-        $sql = "SELECT";
-		$sql.= " t.rowid,";
-		$sql.= " t.field1,";
-		$sql.= " t.field2";
+	}
+
+	/**
+	 * Load object in memory from the database
+	 *
+	 * @param int    $id  Id object
+	 * @param string $ref Ref
+	 *
+	 * @return int <0 if KO, 0 if not found, >0 if OK
+	 */
+	public function fetch( $id, $ref = null )
+	{
+		dol_syslog( __METHOD__, LOG_DEBUG );
+
+		$sql = 'SELECT';
+		$sql .= ' t.rowid,';
+		$sql .= ' t.field1,';
+		$sql .= ' t.field2';
 		//...
-        $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
-        if ($ref) $sql.= " WHERE t.ref = '".$ref."'";
-        else $sql.= " WHERE t.rowid = ".$id;
-
-    	dol_syslog(get_class($this)."::fetch");
-        $resql=$this->db->query($sql);
-        if ($resql)
-        {
-        	$numrows = $this->db->num_rows($resql);
-            if ($numrows)
-            {
-                $obj = $this->db->fetch_object($resql);
-
-                $this->id    = $obj->rowid;
-                $this->prop1 = $obj->field1;
-                $this->prop2 = $obj->field2;
+		$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
+		if (null !== $ref) {
+			$sql .= ' WHERE t.ref = ' . '\'' . $ref . '\'';
+		} else {
+			$sql .= ' WHERE t.rowid = ' . $id;
+		}
+
+		$resql = $this->db->query( $sql );
+		if ($resql) {
+			$numrows = $this->db->num_rows( $resql );
+			if ($numrows) {
+				$obj = $this->db->fetch_object( $resql );
+
+				$this->id = $obj->rowid;
+				$this->prop1 = $obj->field1;
+				$this->prop2 = $obj->field2;
 				//...
-            }
-            $this->db->free($resql);
-
-            return ($numrows?1:0);
-        }
-        else
-        {
-      	    $this->error="Error ".$this->db->lasterror();
-            return -1;
-        }
-    }
-
-    /**
-     *  Load object in memory from the database
-     *
-     * @param string $sortorder Sort Order
+			}
+			$this->db->free( $resql );
+
+			if ($numrows) {
+				return 1;
+			} else {
+				return 0;
+			}
+		} else {
+			$this->errors[] = 'Error ' . $this->db->lasterror();
+			dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
+
+			return - 1;
+		}
+	}
+
+	/**
+	 * Load object in memory from the database
+	 *
+	 * @param string $sortorder Sort Order
 	 * @param string $sortfield Sort field
-	 * @param int $limit offset limit
-	 * @param int $offset offset limit
-	 * @param array $filter filter array
+	 * @param int    $limit     offset limit
+	 * @param int    $offset    offset limit
+	 * @param array  $filter    filter array
+	 *
 	 * @return int <0 if KO, >0 if OK
-     */
-    function fetchAll($sortorder, $sortfield, $limit, $offset, $filter = array())
-    {
-    	global $langs;
-    	$sql = "SELECT";
-    	$sql.= " t.rowid,";
-    	$sql.= " t.field1,";
-    	$sql.= " t.field2";
-    	//...
-    	$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
-
-    	// Manage filter
-    	$sqlwhere=array();
-    	if (count($filter)>0) {
-    		foreach ( $filter as $key => $value ) {
-    			//$sqlwhere []= ' AND '. $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
-    		}
-    	}
-    	if (count($sqlwhere)>0) {
-    		$sql.= ' WHERE '.implode(' AND ', $sqlwhere);
-    	}
-    	$sql .= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit + 1, $offset);
-
-    	$this->lines = array ();
-
-    	dol_syslog(get_class($this)."::fetchAll", LOG_DEBUG);
-    	$resql=$this->db->query($sql);
-    	if ($resql)
-    	{
-    		$num = $this->db->num_rows($resql);
-
-    		while ($obj = $this->db->fetch_object($resql))
-    		{
-    			$line=new Skeleton_ClassLine();
-
-    			$line->id    = $obj->rowid;
-    			$line->prop1 = $obj->field1;
-    			$line->prop2 = $obj->field2;
-
-    			$this->lines[]=$line;
-    			//...
-    		}
-    		$this->db->free($resql);
-
-    		return $num;
-    	}
-    	else
-    	{
-    		$this->error="Error ".$this->db->lasterror();
-    		dol_syslog(get_class($this)."::fetchAll ".$this->error, LOG_ERR);
-    		return -1;
-    	}
-    }
-
-
-    /**
-     *  Update object into database
-     *
-     *  @param	User	$user        User that modifies
-     *  @param  int		$notrigger	 0=launch triggers after, 1=disable triggers
-     *  @return int     		   	 <0 if KO, >0 if OK
-     */
-    function update($user, $notrigger=0)
-    {
-    	global $conf, $langs;
-		$error=0;
+	 */
+	public function fetchAll( $sortorder, $sortfield, $limit, $offset, array $filter = array() )
+	{
+		dol_syslog( __METHOD__, LOG_DEBUG );
+
+		$sql = 'SELECT';
+		$sql .= ' t.rowid,';
+		$sql .= ' t.field1,';
+		$sql .= ' t.field2';
+		//...
+		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'mytable as t';
+
+		// Manage filter
+		$sqlwhere = array();
+		if (count( $filter ) > 0) {
+			foreach ($filter as $key => $value) {
+				$sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape( $value ) . '%\'';
+			}
+		}
+		if (count( $sqlwhere ) > 0) {
+			$sql .= ' WHERE ' . implode( ' AND ', $sqlwhere );
+		}
+		$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ' . $this->db->plimit( $limit + 1, $offset );
+
+		$this->lines = array();
+
+		$resql = $this->db->query( $sql );
+		if ($resql) {
+			$num = $this->db->num_rows( $resql );
+
+			while ($obj = $this->db->fetch_object( $resql )) {
+				$line = new Skeleton_ClassLine();
+
+				$line->id = $obj->rowid;
+				$line->prop1 = $obj->field1;
+				$line->prop2 = $obj->field2;
+
+				$this->lines[] = $line;
+				//...
+			}
+			$this->db->free( $resql );
+
+			return $num;
+		} else {
+			$this->errors[] = 'Error ' . $this->db->lasterror();
+			dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
+
+			return - 1;
+		}
+	}
+
+	/**
+	 * Update object into database
+	 *
+	 * @param  User $user      User that modifies
+	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
+	 *
+	 * @return int <0 if KO, >0 if OK
+	 */
+	public function update( User $user, $notrigger = false )
+	{
+		$error = 0;
+
+		dol_syslog( __METHOD__, LOG_DEBUG );
 
 		// Clean parameters
-        if (isset($this->prop1)) $this->prop1=trim($this->prop1);
-        if (isset($this->prop2)) $this->prop2=trim($this->prop2);
+		if (isset( $this->prop1 )) {
+			$this->prop1 = trim( $this->prop1 );
+		}
+		if (isset( $this->prop2 )) {
+			$this->prop2 = trim( $this->prop2 );
+		}
 		//...
 
 		// Check parameters
 		// Put here code to add a control on parameters values
 
-        // Update request
-        $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
-        $sql.= " field1=".(isset($this->field1)?"'".$this->db->escape($this->field1)."'":"null").",";
-        $sql.= " field2=".(isset($this->field2)?"'".$this->db->escape($this->field2)."'":"null")."";
+		// Update request
+		$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
+		if (isset( $this->field1 )) {
+			$sql .= ' field1=\'' . $this->db->escape( $this->field1 ) . '\',';
+		} else {
+			$sql .= ' field1=null' . ',';
+		}
+		if (isset( $this->field2 )) {
+			$sql .= ' field2=\'' . $this->db->escape( $this->field2 ) . '\'';
+		} else {
+			$sql .= ' field2=null';
+		}
 		//...
-        $sql.= " WHERE rowid=".$this->id;
+		$sql .= ' WHERE rowid=' . $this->id;
 
 		$this->db->begin();
 
-		dol_syslog(__METHOD__);
-        $resql = $this->db->query($sql);
-    	if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+		$resql = $this->db->query( $sql );
+		if (!$resql) {
+			$error ++;
+			$this->errors[] = 'Error ' . $this->db->lasterror();
+			dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
+		}
 
-		if (! $error && ! $notrigger)
-		{
-            // Uncomment this and change MYOBJECT to your own tag if you
-            // want this action calls a trigger.
+		if (!$error && !$notrigger) {
+			// Uncomment this and change MYOBJECT to your own tag if you
+			// want this action calls a trigger.
 
-            //// Call triggers
-            //$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
-            //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
-            //// End call triggers
+			//// Call triggers
+			//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
+			//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
+			//// End call triggers
 		}
 
-        // Commit or rollback
-		if ($error)
-		{
+		// Commit or rollback
+		if ($error) {
 			$this->db->rollback();
-			return -1*$error;
-		}
-		else
-		{
+
+			return - 1 * $error;
+		} else {
 			$this->db->commit();
+
 			return 1;
 		}
-    }
-
+	}
 
- 	/**
-	 *  Delete object in database
+	/**
+	 * Delete object in database
 	 *
-     *	@param  User	$user        User that deletes
-     *  @param  int		$notrigger	 0=launch triggers after, 1=disable triggers
-	 *  @return	int					 <0 if KO, >0 if OK
+	 * @param User $user      User that deletes
+	 * @param bool $notrigger false=launch triggers after, true=disable triggers
+	 *
+	 * @return int <0 if KO, >0 if OK
 	 */
-	function delete($user, $notrigger=0)
+	public function delete( User $user, $notrigger = false )
 	{
-		global $conf, $langs;
-		$error=0;
+		dol_syslog( __METHOD__, LOG_DEBUG );
+
+		$error = 0;
 
 		$this->db->begin();
 
-		if (! $error)
-		{
-			if (! $notrigger)
-			{
+		if (!$error) {
+			if (!$notrigger) {
 				// Uncomment this and change MYOBJECT to your own tag if you
-		        // want this action calls a trigger.
+				// want this action calls a trigger.
 
-	            //// Call triggers
-	            //$result=$this->call_trigger('MYOBJECT_DELETE',$user);
-	            //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
-	            //// End call triggers
+				//// Call triggers
+				//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
+				//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
+				//// End call triggers
 			}
 		}
 
-		if (! $error)
-		{
-    		$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
-    		$sql.= " WHERE rowid=".$this->id;
+		if (!$error) {
+			$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
+			$sql .= ' WHERE rowid=' . $this->id;
 
-    		dol_syslog(__METHOD__);
-    		$resql = $this->db->query($sql);
-        	if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+			$resql = $this->db->query( $sql );
+			if (!$resql) {
+				$error ++;
+				$this->errors[] = 'Error ' . $this->db->lasterror();
+				dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
+			}
 		}
 
-        // Commit or rollback
-		if ($error)
-		{
+		// Commit or rollback
+		if ($error) {
 			$this->db->rollback();
-			return -1*$error;
-		}
-		else
-		{
+
+			return - 1 * $error;
+		} else {
 			$this->db->commit();
+
 			return 1;
 		}
 	}
 
-
-
 	/**
-	 *	Load an object from its id and create a new one in database
+	 * Load an object from its id and create a new one in database
+	 *
+	 * @param int $fromid Id of object to clone
 	 *
-	 *	@param	int		$fromid     Id of object to clone
-	 * 	@return	int					New id of clone
+	 * @return int New id of clone
 	 */
-	function createFromClone($fromid)
+	public function createFromClone( $fromid )
 	{
-		global $user,$langs;
+		dol_syslog( __METHOD__, LOG_DEBUG );
 
-		$error=0;
-
-		$object=new Skeleton_Class($this->db);
+		global $user;
+		$error = 0;
+		$object = new Skeleton_Class( $this->db );
 
 		$this->db->begin();
 
 		// Load source object
-		$object->fetch($fromid);
-		$object->id=0;
-		$object->statut=0;
+		$object->fetch( $fromid );
+		// Reset object
+		$object->id = 0;
 
 		// Clear fields
 		// ...
 
 		// Create clone
-		$result=$object->create($user);
+		$result = $object->create( $user );
 
 		// Other options
-		if ($result < 0)
-		{
-			$this->error=$object->error;
-			$error++;
-		}
-
-		if (! $error)
-		{
-
-
+		if ($result < 0) {
+			$error ++;
+			$this->errors = $object->errors;
+			dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
 		}
 
 		// End
-		if (! $error)
-		{
+		if (!$error) {
 			$this->db->commit();
+
 			return $object->id;
-		}
-		else
-		{
+		} else {
 			$this->db->rollback();
-			return -1;
+
+			return - 1;
 		}
 	}
 
-
 	/**
-	 *	Initialise object with example values
-	 *	Id must be 0 if object instance is a specimen
+	 * Initialise object with example values
+	 * Id must be 0 if object instance is a specimen
 	 *
-	 *	@return	void
+	 * @return void
 	 */
-	function initAsSpecimen()
+	public function initAsSpecimen()
 	{
-		$this->id=0;
-		$this->prop1='prop1';
-		$this->prop2='prop2';
+		$this->id = 0;
+		$this->prop1 = 'prop1';
+		$this->prop2 = 'prop2';
 	}
 
 }
 
+/**
+ * Class Skeleton_ClassLine
+ */
 class Skeleton_ClassLine
 {
-	var $id;
-	var $prop1;
-	var $prop2;
+	/**
+	 * @var int ID
+	 */
+	public $id;
+	/**
+	 * @var mixed Sample line property 1
+	 */
+	public $prop1;
+	/**
+	 * @var mixed Sample line property 2
+	 */
+	public $prop2;
 }

+ 2 - 0
htdocs/adherents/canvas/actions_adherentcard_common.class.php

@@ -55,6 +55,8 @@ abstract class ActionsAdherentCardCommon
 	 */
 	private function getInstanceDao()
 	{
+		dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 		if (! is_object($this->object))
 		{
 			$modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php');

+ 0 - 1
htdocs/adherents/class/adherent_type.class.php

@@ -39,7 +39,6 @@ class AdherentType extends CommonObject
 
     /**
      * @var int
-     * @deprecated Use rowid
      */
     public $ref;
 

+ 11 - 0
htdocs/admin/company.php

@@ -4,6 +4,7 @@
  * Copyright (C) 2005-2012	Regis Houssin			<regis.houssin@capnetworks.com>
  * Copyright (C) 2010-2014	Juanjo Menent			<jmenent@2byte.es>
  * Copyright (C) 2011		Philippe Grand			<philippe.grand@atoo-net.com>
+ * Copyright (C) 2015       Alexandre Spangaro      <alexandre.spangaro@gmail.com>
  *
  * 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
@@ -151,6 +152,7 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
     dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity);
 
     dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity);
+	dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT",$_POST["object"],'chaine',0,'',$conf->entity);
 
     dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity);
 
@@ -528,6 +530,12 @@ if ($action == 'edit' || $action == 'updateedit')
     $var=!$var;
     print '<tr '.$bc[$var].'><td width="35%"><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
     print '<input name="tva" id="intra_vat" size="20" value="' . (! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
+    print '</td></tr>';
+	
+	// Object of the company
+    $var=!$var;
+    print '<tr '.$bc[$var].'><td width="35%"><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
+    print '<textarea class="flat" name="object" id="object" cols="80" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
     print '</td></tr>';
 
     print '</table>';
@@ -929,6 +937,9 @@ else
     }
     print '</td>';
     print '</tr>';
+	
+	$var=!$var;
+    print '<tr '.$bc[$var].'><td width="35%" valign="top">'.$langs->trans("CompanyObject").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '</td></tr>';
 
     print '</table>';
     print '</form>';

+ 32 - 30
htdocs/api/class/api.class.php

@@ -22,24 +22,24 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
 
 /**
  * Class for API
- * 
+ *
  */
 class DolibarrApi
 {
-    
+
     /**
      * @var DoliDb        $db Database object
      */
     static protected $db;
-    
+
     /**
      * @var Restler     $r	Restler object
      */
     var $r;
-            
+
     /**
      * Constructor
-     * 
+     *
      * @param	DoliDb	$db		Database handler
      */
     function __construct($db) {
@@ -51,7 +51,7 @@ class DolibarrApi
      * Executed method when API is called without parameter
      *
      * Display a short message an return a http code 200
-     * 
+     *
      * @return array
      */
     function index()
@@ -67,10 +67,10 @@ class DolibarrApi
 
     /**
      * Clean sensible object datas
-     * 
+     *
      * @param   object  $object	Object to clean
      * @return	array	Array of cleaned object properties
-     * 
+     *
      * @todo use an array for properties to clean
      *
      */
@@ -78,14 +78,16 @@ class DolibarrApi
 
         // Remove $db object property for object
 		unset($object->db);
-        
+
         // If object has lines, remove $db property
         if(isset($object->lines) && count($object->lines) > 0)  {
-            for($i=0; $i < count($object->lines); $i++) {
+            $nboflines = count($object->lines);
+        	for ($i=0; $i < $nbofline; $i++)
+            {
                 $this->_cleanObjectDatas($object->lines[$i]);
             }
         }
-        
+
         // If object has linked objects, remove $db property
         if(isset($object->linkedObjects) && count($object->linkedObjects) > 0)  {
             foreach($object->linkedObjects as $type_object => $linked_object) {
@@ -96,12 +98,12 @@ class DolibarrApi
         }
 		return $object;
     }
-	
+
 	/**
 	 * Check user access to a resource
-	 * 
+	 *
 	 * Check access by user to a given resource
-	 * 
+	 *
 	 * @param string	$resource		element to check
 	 * @param int		$resource_id	Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
 	 * @param type		$dbtablename	'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
@@ -111,18 +113,18 @@ class DolibarrApi
 	 * @throws RestException
 	 */
 	static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') {
-		
+
 		// Features/modules to check
 		$featuresarray = array($resource);
-		if (preg_match('/&/', $resource)) { 
-			$featuresarray = explode("&", $resource); 
+		if (preg_match('/&/', $resource)) {
+			$featuresarray = explode("&", $resource);
 		}
-		else if (preg_match('/\|/', $resource)) { 
-			$featuresarray = explode("|", $resource); 
+		else if (preg_match('/\|/', $resource)) {
+			$featuresarray = explode("|", $resource);
 		}
 
 		// More subfeatures to check
-		if (! empty($feature2)) { 
+		if (! empty($feature2)) {
 			$feature2 = explode("|", $feature2);
 		}
 
@@ -141,18 +143,18 @@ class DolibarrApiInit extends DolibarrApi
 		global $db;
 		$this->db = $db;
 	}
-	
+
 	/**
 	 * Login
-	 * 
+	 *
 	 * Log user with username and password
-	 * 
+	 *
 	 * @param   string  $login			Username
 	 * @param   string  $password		User password
 	 * @param   int     $entity			User entity
      * @return  array   Response status and user token
-     * 
-	 * @throws RestException	
+     *
+	 * @throws RestException
 	 */
 	public function login($login, $password, $entity = 0) {
 
@@ -171,22 +173,22 @@ class DolibarrApiInit extends DolibarrApi
 		{
 			throw new RestException(403, 'Access denied');
 		}
-		
+
 		// Generate token for user
 		$token = dol_hash($login.uniqid().$conf->global->MAIN_API_KEY,1);
-		
+
 		// We store API token into database
 		$sql = "UPDATE ".MAIN_DB_PREFIX."user";
 		$sql.= " SET api_key = '".$this->db->escape($token)."'";
 		$sql.= " WHERE login = '".$this->db->escape($login)."'";
-		
+
 		dol_syslog(get_class($this)."::login", LOG_DEBUG);	// No log
 		$result = $this->db->query($sql);
 		if (!$result)
 		{
 			throw new RestException(500, 'Error when updating user :'.$this->db->error_msg);
 		}
-		
+
 		//return token
 		return array(
 			'success' => array(
@@ -199,7 +201,7 @@ class DolibarrApiInit extends DolibarrApi
 
 	/**
      * Get status (Dolibarr version)
-     * 
+     *
 	 * @access protected
 	 * @class  DolibarrApiAccess {@requires admin}
 	 */

+ 20 - 22
htdocs/api/class/api_access.class.php

@@ -18,7 +18,7 @@
 use \Luracast\Restler\iAuthenticate;
 use \Luracast\Restler\Resources;
 use \Luracast\Restler\Defaults;
-use Luracast\Restler\RestException;
+use \Luracast\Restler\RestException;
 
 
 /**
@@ -44,24 +44,14 @@ class DolibarrApiAccess implements iAuthenticate
 	 */
 	public static $user = '';
 
-    // @codingStandardsIgnoreStart
-
-    /**
-     * @return string string to be used with WWW-Authenticate header
-     * @example Basic
-     * @example Digest
-     * @example OAuth
-     */
-    public function __getWWWAuthenticateString();
-
 	/**
 	 * Check access
 	 *
-	 * @return boolean
+	 * @return bool
+	 * @throws RestException
 	 */
 	public function _isAllowed()
-    {
-    // @codingStandardsIgnoreEnd
+	{
 		global $db;
 
 		$stored_key = '';
@@ -74,7 +64,8 @@ class DolibarrApiAccess implements iAuthenticate
 			$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
 			$sql.= " WHERE u.api_key = '".$db->escape($_GET['api_key'])."'";
 
-			if ($db->query($sql))
+			$result = $db->query($sql);
+			if ($result)
 			{
 				if ($db->num_rows($result))
 				{
@@ -116,19 +107,26 @@ class DolibarrApiAccess implements iAuthenticate
 	}
 
     // @codingStandardsIgnoreStart
-	public function __getWWWAuthenticateString()
+	/**
+	 * @return string string to be used with WWW-Authenticate header
+	 * @example Basic
+	 * @example Digest
+	 * @example OAuth
+	 */
+	public function _getWWWAuthenticateString()
     {
         return '';
     }
     // @codingStandardsIgnoreEnd
 
 	/**
-     * Verify access
-     *
-     * @param   array   $m   Properties of method
-     *
-     * @access private
-     */
+	 * Verify access
+	 *
+	 * @param   array $m Properties of method
+	 *
+	 * @access private
+	 * @return bool
+	 */
     public static function verifyAccess(array $m)
     {
         $requires = isset($m['class']['DolibarrApiAccess']['properties']['requires'])

+ 10 - 0
htdocs/categories/class/categorie.class.php

@@ -1228,6 +1228,11 @@ class Categorie extends CommonObject
 	 */
 	function containing($id,$type,$mode='object')
 	{
+		// Deprecation warning
+		if (is_numeric($type)) {
+			dol_syslog(__METHOD__ . ': using numeric types is deprecated.', LOG_WARNING);
+		}
+
 		$cats = array();
 
 		// For backward compatibility
@@ -1284,6 +1289,11 @@ class Categorie extends CommonObject
 	 */
 	function rechercher($id, $nom, $type, $exact = false, $case = false)
 	{
+		// Deprecation warning
+		if (is_numeric($type)) {
+			dol_syslog(__METHOD__ . ': using numeric types is deprecated.', LOG_WARNING);
+		}
+
 		$cats = array();
 
 		// For backward compatibility

+ 12 - 12
htdocs/comm/action/card.php

@@ -96,7 +96,7 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
 {
 	$idtoremove=GETPOST('removedassigned');
 
-	if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1);
+	if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=json_decode($_SESSION['assignedtouser'],1);
 	else $tmpassigneduserids=array();
 
 	foreach ($tmpassigneduserids as $key => $val)
@@ -104,7 +104,7 @@ if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
 		if ($val['id'] == $idtoremove || $val['id'] == -1) unset($tmpassigneduserids[$key]);
 	}
 	//var_dump($_POST['removedassigned']);exit;
-	$_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids);
+	$_SESSION['assignedtouser']=json_encode($tmpassigneduserids);
 	$donotclearsession=1;
 	if ($action == 'add') $action = 'create';
 	if ($action == 'update') $action = 'edit';
@@ -119,10 +119,10 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
 		$assignedtouser=array();
 		if (! empty($_SESSION['assignedtouser']))
 		{
-			$assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
+			$assignedtouser=json_decode($_SESSION['assignedtouser'], true);
 		}
 		$assignedtouser[GETPOST('assignedtouser')]=array('id'=>GETPOST('assignedtouser'), 'transparency'=>GETPOST('transparency'),'mandatory'=>1);
-		$_SESSION['assignedtouser']=dol_json_encode($assignedtouser);
+		$_SESSION['assignedtouser']=json_encode($assignedtouser);
 	}
 	$donotclearsession=1;
 	if ($action == 'add') $action = 'create';
@@ -215,7 +215,7 @@ if ($action == 'add')
 		$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
 
 		$listofuserid=array();
-		if (! empty($_SESSION['assignedtouser'])) $listofuserid=dol_json_decode($_SESSION['assignedtouser']);
+		if (! empty($_SESSION['assignedtouser'])) $listofuserid=json_decode($_SESSION['assignedtouser']);
 		$i=0;
 		foreach($listofuserid as $key => $value)
 		{
@@ -387,7 +387,7 @@ if ($action == 'update')
 		if (! empty($_SESSION['assignedtouser']))	// Now concat assigned users
 		{
 			// Restore array with key with same value than param 'id'
-			$tmplist1=dol_json_decode($_SESSION['assignedtouser'], true); $tmplist2=array();
+			$tmplist1=json_decode($_SESSION['assignedtouser'], true); $tmplist2=array();
 			foreach($tmplist1 as $key => $val)
 			{
 				if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val;
@@ -677,13 +677,13 @@ if ($action == 'create')
 	{
 		$assignedtouser=GETPOST("assignedtouser")?GETPOST("assignedtouser"):(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id);
 		if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency);	// Owner first
-		$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
+		$_SESSION['assignedtouser']=json_encode($listofuserid);
 	}
 	else
 	{
 		if (!empty($_SESSION['assignedtouser']))
 		{
-			$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true);
+			$listofuserid=json_decode($_SESSION['assignedtouser'], true);
 		}
 	}
 	print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0');
@@ -929,13 +929,13 @@ if ($id > 0)
 					if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
 				}
 			}
-			$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
+			$_SESSION['assignedtouser']=json_encode($listofuserid);
 		}
 		else
 		{
 			if (!empty($_SESSION['assignedtouser']))
 			{
-				$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true);
+				$listofuserid=json_decode($_SESSION['assignedtouser'], true);
 			}
 		}
 		print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0');
@@ -1101,13 +1101,13 @@ if ($id > 0)
 					if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
 				}
 			}
-			$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
+			$_SESSION['assignedtouser']=json_encode($listofuserid);
 		}
 		else
 		{
 			if (!empty($_SESSION['assignedtouser']))
 			{
-				$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true);
+				$listofuserid=json_decode($_SESSION['assignedtouser'], true);
 			}
 		}
 		print $form->select_dolusers_forevent('view','assignedtouser',1);

+ 10 - 1
htdocs/comm/action/class/actioncomm.class.php

@@ -61,6 +61,7 @@ class ActionComm extends CommonObject
     /**
      * @var string
      * @deprecated Use $label
+     * @see label
      */
     public $libelle;
 
@@ -71,6 +72,7 @@ class ActionComm extends CommonObject
      * Object user that create action
      * @var User
      * @deprecated
+     * @see authorid
      */
     var $author;
 
@@ -78,6 +80,7 @@ class ActionComm extends CommonObject
      * Object user that modified action
      * @var User
      * @deprecated
+     * @see usermodid
      */
     var $usermod;
     var $authorid;		// Id user that create action
@@ -114,6 +117,7 @@ class ActionComm extends CommonObject
      * Object user of owner
      * @var User
      * @deprecated
+     * @see userownerid
      */
     var $usertodo;
 
@@ -121,6 +125,7 @@ class ActionComm extends CommonObject
      * Object user that did action
      * @var User
      * @deprecated
+     * @see userdoneid
      */
     var $userdone;
 
@@ -130,12 +135,16 @@ class ActionComm extends CommonObject
     /**
      * Company linked to action (optional)
      * @var Societe|null
+     * @deprecated
+     * @see socid
      */
     var $societe;
 
     /**
      * Contact linked to action (optional)
      * @var Contact|null
+     * @deprecated
+     * @see contactid
      */
     var $contact;
 
@@ -468,7 +477,7 @@ class ActionComm extends CommonObject
                 $this->fulldayevent			= $obj->fulldayevent;
                 $this->location				= $obj->location;
                 $this->transparency			= $obj->transparency;
-                $this->punctual				= $obj->punctual;
+                $this->punctual				= $obj->punctual;       // deprecated
 
                 $this->socid				= $obj->fk_soc;			// To have fetch_thirdparty method working
                 $this->contactid			= $obj->fk_contact;		// To have fetch_contact method working

+ 2 - 2
htdocs/comm/action/document.php

@@ -186,13 +186,13 @@ if ($object->id > 0)
 				if ($val['id'] && $val['id'] != $object->userownerid) $listofuserid[$val['id']]=$val;
 			}
 		}
-		$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
+		$_SESSION['assignedtouser']=json_encode($listofuserid);
 	}
 	else
 	{
 		if (!empty($_SESSION['assignedtouser']))
 		{
-			$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true);
+			$listofuserid=json_decode($_SESSION['assignedtouser'], true);
 		}
 	}
 	print $form->select_dolusers_forevent('view','assignedtouser',1);

+ 98 - 14
htdocs/comm/askpricesupplier/class/askpricesupplier.class.php

@@ -59,14 +59,42 @@ class AskPriceSupplier extends CommonObject
     var $client;		// Objet societe client (a charger par fetch_client)
 
     var $fk_project;
+	/**
+	 * @deprecated
+	 * @see user_author_id
+	 */
     var $author;
     var $ref;
 	var $ref_fourn;  //Reference saisie lors de l'ajout d'une ligne à la demande
     var $statut;					// 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed)
-    var $datec;						// Date of creation
     var $date;						// Date of proposal
     var $date_livraison;
 
+	/**
+	 * @deprecated
+	 * @see date_creation
+	 */
+	var $datec;
+
+	/**
+	 * Creation date
+	 * @var int
+	 */
+	public $date_creation;
+
+	/**
+	 * @deprecated
+	 * @see date_validation
+	 */
+	var $datev;
+
+	/**
+	 * Validation date
+	 * @var int
+	 */
+	public $date_validation;
+
+
     var $user_author_id;
     var $user_valid_id;
     var $user_close_id;
@@ -76,9 +104,22 @@ class AskPriceSupplier extends CommonObject
     var $total_localtax1;			// Total Local Taxes 1
     var $total_localtax2;			// Total Local Taxes 2
     var $total_ttc;					// Total with tax
-    var $price;						// deprecated (for compatibility)
-    var $tva;						// deprecated (for compatibility)
-    var $total;						// deprecated (for compatibility)
+
+	/**
+	 * @deprecated
+	 * @see price_ht
+	 */
+    var $price;
+	/**
+	 * @deprecated
+	 * @see total_tva
+	 */
+    var $tva;
+	/**
+	 * @deprecated
+	 * @see total_ttc
+	 */
+    var $total;
 
     var $cond_reglement_id;
     var $cond_reglement_code;
@@ -88,7 +129,11 @@ class AskPriceSupplier extends CommonObject
     var $remise;
     var $remise_percent;
     var $remise_absolue;
-    var $note;						// deprecated (for compatibility)
+	/**
+	 * @deprecated
+	 * @see note_public, note_private
+	 */
+    var $note;
     var $note_private;
     var $note_public;
     var $shipping_method_id;
@@ -1031,7 +1076,7 @@ class AskPriceSupplier extends CommonObject
                 $this->remise               = $obj->remise;
                 $this->remise_percent       = $obj->remise_percent;
                 $this->remise_absolue       = $obj->remise_absolue;
-                $this->total                = $obj->total; // TODO obsolete
+                $this->total                = $obj->total; // TODO deprecated
                 $this->total_ht             = $obj->total_ht;
                 $this->total_tva            = $obj->tva;
                 $this->total_localtax1		= $obj->localtax1;
@@ -1040,14 +1085,14 @@ class AskPriceSupplier extends CommonObject
                 $this->socid                = $obj->fk_soc;
                 $this->fk_project           = $obj->fk_projet;
                 $this->modelpdf             = $obj->model_pdf;
-                $this->note                 = $obj->note_private; // TODO obsolete
+                $this->note                 = $obj->note_private; // TODO deprecated
                 $this->note_private         = $obj->note_private;
                 $this->note_public          = $obj->note_public;
                 $this->statut               = $obj->fk_statut;
                 $this->statut_libelle       = $obj->statut_label;
 
-                $this->datec                = $this->db->jdate($obj->datec); // TODO obsolete
-                $this->datev                = $this->db->jdate($obj->datev); // TODO obsolete
+                $this->datec                = $this->db->jdate($obj->datec); // TODO deprecated
+                $this->datev                = $this->db->jdate($obj->datev); // TODO deprecated
                 $this->date_creation		= $this->db->jdate($obj->datec); //Creation date
                 $this->date_validation		= $this->db->jdate($obj->datev); //Validation date
                 $this->date_livraison       = $this->db->jdate($obj->date_livraison);
@@ -2431,7 +2476,17 @@ class AskPriceSupplierLine  extends CommonObject
     var $fk_parent_line;
     var $desc;          	// Description ligne
     var $fk_product;		// Id produit predefini
-    var $product_type = 0;	// Type 0 = product, 1 = Service
+	/**
+	 * @deprecated
+	 * @see product_type
+	 */
+	var $fk_product_type;
+	/**
+	 * Product type
+	 * @var int
+	 * @see Product::TYPE_PRODUCT, Product::TYPE_SERVICE
+	 */
+    public $product_type = Product::TYPE_PRODUCT;
 
     var $qty;
     var $tva_tx;
@@ -2459,14 +2514,43 @@ class AskPriceSupplierLine  extends CommonObject
     var $total_tva;			// Total TVA  de la ligne toute quantite et incluant la remise ligne
     var $total_ttc;			// Total TTC de la ligne toute quantite et incluant la remise ligne
 
-    // Ne plus utiliser
+	/**
+	 * @deprecated
+	 * @see remise_percent, fk_remise_except
+	 */
     var $remise;
+	/**
+	 * @deprecated
+	 * @see subprice
+	 */
     var $price;
 
     // From llx_product
-    var $ref;						// Reference produit
-    var $libelle;       // Label produit
-    var $product_desc;  // Description produit
+	/**
+	 * @deprecated
+	 * @see product_ref
+	 */
+	var $ref;
+	/**
+	 * Product reference
+	 * @var string
+	 */
+	public $product_ref;
+	/**
+	 * @deprecated
+	 * @see product_label
+	 */
+	var $libelle;
+	/**
+	 *  Product label
+	 * @var string
+	 */
+	public $product_label;
+	/**
+	 * Product description
+	 * @var string
+	 */
+	public $product_desc;
 
     var $localtax1_tx;		// Local tax 1
     var $localtax2_tx;		// Local tax 2

+ 1 - 1
htdocs/comm/card.php

@@ -140,7 +140,7 @@ if (empty($reshook))
 		if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
 	}
 
-	// update prospect level
+	// set communication status
 	if ($action == 'setstcomm')
 	{
 		$object->fetch($id);

+ 24 - 1
htdocs/comm/mailing/class/mailing.class.php

@@ -421,7 +421,7 @@ class Mailing extends CommonObject
 		$resql=$this->db->query($sql);
 		if ($resql)
 		{
-			return 1;
+			return $this->delete_targets();
 		}
 		else
 		{
@@ -429,6 +429,29 @@ class Mailing extends CommonObject
 			return -1;
 		}
 	}
+	
+	/**
+	 *  Delete targets emailing
+	 *
+	 *  @return int       1 if OK, 0 if error
+	 */
+	function delete_targets()
+	{
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
+		$sql.= " WHERE fk_mailing = ".$this->id;
+
+		dol_syslog("Mailing::delete_targets", LOG_DEBUG);
+		$resql=$this->db->query($sql);
+		if ($resql)
+		{
+			return 1;
+		}
+		else
+		{
+			$this->error=$this->db->lasterror();
+			return 0;
+		}
+	}
 
 
 	/**

+ 89 - 30
htdocs/comm/propal/class/propal.class.php

@@ -75,26 +75,35 @@ class Propal extends CommonObject
 
 	/**
 	 * Status of the quote
-	 * Check the following constants:
-	 * - STATUS_DRAFT
-	 * - STATUS_VALIDATED
-	 * - STATUS_SIGNED
-	 * - STATUS_NOTSIGNED
-	 * - STATUS_BILLED
 	 * @var int
+	 * @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED
 	 */
     var $statut;
 
 	/**
-	 * Date of creation
-	 * @var
+	 * @deprecated
+	 * @see date_creation
 	 */
     var $datec;
+
 	/**
-	 * Date of validation
-	 * @var
+	 * Creation date
+	 * @var int
+	 */
+	public $date_creation;
+
+	/**
+	 * @deprecated
+	 * @see date_validation
 	 */
     var $datev;
+
+	/**
+	 * Validation date
+	 * @var int
+	 */
+	public $date_validation;
+
 	/**
 	 * Date of the quote
 	 * @var
@@ -102,8 +111,8 @@ class Propal extends CommonObject
     var $date;
 
 	/**
-	 * Same than date ¿?
-	 * @var
+	 * @deprecated
+	 * @see date
 	 */
     var $datep;
     var $date_livraison;
@@ -121,14 +130,17 @@ class Propal extends CommonObject
 
 	/**
 	 * @deprecated
+	 * @see total_ht
 	 */
     var $price;
 	/**
 	 * @deprecated
+	 * @see total_tva
 	 */
     var $tva;
 	/**
 	 * @deprecated
+	 * @see total_ttc
 	 */
     var $total;
 
@@ -142,6 +154,7 @@ class Propal extends CommonObject
     var $remise_absolue;
 	/**
 	 * @deprecated
+	 * @see note_private, note_public
 	 */
     var $note;
     var $note_private;
@@ -1048,8 +1061,10 @@ class Propal extends CommonObject
      */
     function createFromClone($socid=0)
     {
-        global $user,$langs,$conf,$hookmanager;
-
+        global $db, $user,$langs,$conf,$hookmanager;
+		
+		dol_include_once('/projet/class.project.class.php');
+				
         $this->context['createfromclone']='createfromclone';
 
         $error=0;
@@ -1074,7 +1089,16 @@ class Propal extends CommonObject
                 $this->socid 				= $objsoc->id;
                 $this->cond_reglement_id	= (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
                 $this->mode_reglement_id	= (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
-                $this->fk_project			= '';
+				
+				$project = new Project($db);
+				
+				if($objFrom->fk_project > 0 && $project->fetch($objFrom->fk_project)) {
+					if($project->socid <= 0) $this->fk_project = $objFrom->fk_project;
+					else $this->fk_project = '';
+				} else {
+					$this->fk_project = '';
+				}
+                
                 $this->fk_delivery_address	= '';
             }
 
@@ -1222,7 +1246,7 @@ class Propal extends CommonObject
                 $this->remise               = $obj->remise;
                 $this->remise_percent       = $obj->remise_percent;
                 $this->remise_absolue       = $obj->remise_absolue;
-                $this->total                = $obj->total; // TODO obsolete
+                $this->total                = $obj->total; // TODO deprecated
                 $this->total_ht             = $obj->total_ht;
                 $this->total_tva            = $obj->tva;
                 $this->total_localtax1		= $obj->localtax1;
@@ -1231,14 +1255,14 @@ class Propal extends CommonObject
                 $this->socid                = $obj->fk_soc;
                 $this->fk_project           = $obj->fk_projet;
                 $this->modelpdf             = $obj->model_pdf;
-                $this->note                 = $obj->note_private; // TODO obsolete
+                $this->note                 = $obj->note_private; // TODO deprecated
                 $this->note_private         = $obj->note_private;
                 $this->note_public          = $obj->note_public;
                 $this->statut               = $obj->fk_statut;
                 $this->statut_libelle       = $obj->statut_label;
 
-                $this->datec                = $this->db->jdate($obj->datec); // TODO obsolete
-                $this->datev                = $this->db->jdate($obj->datev); // TODO obsolete
+                $this->datec                = $this->db->jdate($obj->datec); // TODO deprecated
+                $this->datev                = $this->db->jdate($obj->datev); // TODO deprecated
                 $this->date_creation		= $this->db->jdate($obj->datec); //Creation date
                 $this->date_validation		= $this->db->jdate($obj->datev); //Validation date
                 $this->date                 = $this->db->jdate($obj->dp);	// Proposal date
@@ -1967,9 +1991,12 @@ class Propal extends CommonObject
      *
      *	@return     int     	<0 si ko, >0 si ok
      *  @deprecated
+     * @see classifyBilled()
      */
     function classer_facturee()
     {
+		dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
     	return $this->classifyBilled();
     }
 
@@ -2724,7 +2751,7 @@ class Propal extends CommonObject
      *	Return clicable link of object (with eventually picto)
      *
      *	@param      int		$withpicto		Add picto into link
-     *	@param      string	$option			Where point the link ('compta', 'expedition', 'document', ...)
+     *	@param      string	$option			Where point the link ('expedition', 'document', ...)
      *	@param      string	$get_params    	Parametres added to url
      *	@return     string          		String with URL
      */
@@ -2912,17 +2939,19 @@ class PropaleLigne  extends CommonObjectLine
     var $oldline;
 
     // From llx_propaldet
-    var $rowid;
     var $fk_propal;
     var $fk_parent_line;
     var $desc;          	// Description ligne
     var $fk_product;		// Id produit predefini
+	/**
+	 * @deprecated
+	 * @see product_type
+	 */
+	var $fk_product_type;
 	/**
 	 * Product type.
-	 * Use the following constants:
-	 * - Product::TYPE_PRODUCT
-	 * - Product::TYPE_SERVICE
 	 * @var int
+	 * @see Product::TYPE_PRODUCT, Product::TYPE_SERVICE
 	 */
     var $product_type = Product::TYPE_PRODUCT;
 
@@ -2952,14 +2981,43 @@ class PropaleLigne  extends CommonObjectLine
     var $total_tva;			// Total TVA  de la ligne toute quantite et incluant la remise ligne
     var $total_ttc;			// Total TTC de la ligne toute quantite et incluant la remise ligne
 
-    // Ne plus utiliser
+	/**
+	 * @deprecated
+	 * @see $remise_percent, $fk_remise_except
+	 */
     var $remise;
+	/**
+	 * @deprecated
+	 * @see subprice
+	 */
     var $price;
 
     // From llx_product
-    var $ref;						// Reference produit
-    var $libelle;       // Label produit
-    var $product_desc;  // Description produit
+	/**
+	 * @deprecated
+	 * @see product_ref
+	 */
+    var $ref;
+	/**
+	 * Product reference
+	 * @var string
+	 */
+	public $product_ref;
+	/**
+	 * @deprecated
+	 * @see product_label
+	 */
+    var $libelle;
+	/**
+	 *  Product label
+	 * @var string
+	 */
+	public $product_label;
+	/**
+	 * Product description
+	 * @var string
+	 */
+    public $product_desc;
 
     var $localtax1_tx;		// Local tax 1
     var $localtax2_tx;		// Local tax 2
@@ -3007,7 +3065,8 @@ class PropaleLigne  extends CommonObjectLine
 		{
 			$objp = $this->db->fetch_object($result);
 
-			$this->rowid			= $objp->rowid;
+			$this->id               = $objp->rowid;
+			$this->rowid			= $objp->rowid;     // deprecated
 			$this->fk_propal		= $objp->fk_propal;
 			$this->fk_parent_line	= $objp->fk_parent_line;
 			$this->label			= $objp->custom_label;
@@ -3016,7 +3075,7 @@ class PropaleLigne  extends CommonObjectLine
 			$this->price			= $objp->price;		// deprecated
 			$this->subprice			= $objp->subprice;
 			$this->tva_tx			= $objp->tva_tx;
-			$this->remise			= $objp->remise;
+			$this->remise			= $objp->remise;    // deprecated
 			$this->remise_percent	= $objp->remise_percent;
 			$this->fk_remise_except = $objp->fk_remise_except;
 			$this->fk_product		= $objp->fk_product;

+ 1 - 0
htdocs/comm/propal/document.php

@@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
 
 $langs->load('compta');
 $langs->load('other');
+$langs->load('companies');
 
 $action		= GETPOST('action','alpha');
 $confirm	= GETPOST('confirm','alpha');

+ 3 - 2
htdocs/comm/propal/note.php

@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2004      Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2004      Eric Seigne          <eric.seigne@ryxeo.com>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2013      Florian Henry		  	<florian.henry@open-concept.pro>
@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
 $langs->load('propal');
 $langs->load('compta');
 $langs->load('bills');
+$langs->load("companies");
 
 $id = GETPOST('id','int');
 $ref=GETPOST('ref','alpha');
@@ -103,7 +104,7 @@ if ($id > 0 || ! empty($ref))
 			print "<tr><td>".$langs->trans("Company")."</td>";
 			print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
 
-			// Ligne info remises tiers
+			// Discounts
 			print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
 			if ($societe->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_percent);
 			else print $langs->trans("CompanyHasNoRelativeDiscount");

+ 11 - 9
htdocs/comm/prospect/list.php

@@ -204,6 +204,9 @@ if (empty($reshook))
 
 $formother=new FormOther($db);
 $form=new Form($db);
+$prospectstatic=new Client($db);
+$prospectstatic->client=2;
+$prospectstatic->loadCacheOfProspStatus();
 
 $sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
 $sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,";
@@ -353,7 +356,7 @@ if ($resql)
 	print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">';
     print '</td>';
 
- 	// Prospect levelt
+ 	// Prospect level
  	print '<td class="liste_titre" align="center">';
  	$options_from = '<option value="">&nbsp;</option>';	 	// Generate in $options_from the list of each option sorted
  	foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
@@ -380,9 +383,12 @@ if ($resql)
 
     // Prospect status
     print '<td class="liste_titre" align="center">';
-	// TODO Add here a list of prospect status
-    //print $form->selectarray($htmlname, $array, $search_stcomm);
-    //print '&nbsp;';
+    $arraystcomm=array();
+	foreach($prospectstatic->cacheprospectstatus as $key => $val)
+	{
+		$arraystcomm[$val['id']]=$val['label'];
+	}
+    print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, 1);
     print '</td>';
 
     print '<td class="liste_titre" align="center">';
@@ -390,7 +396,7 @@ if ($resql)
     print '</td>';
 
     print '<td class="liste_titre" align="center">';
-     print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
+    print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
     print '</td>';
 
     // Print the search button
@@ -407,10 +413,6 @@ if ($resql)
 	$i = 0;
 	$var=true;
 
-	$prospectstatic=new Client($db);
-	$prospectstatic->client=2;
-	$prospectstatic->loadCacheOfProspStatus();
-
 	while ($i < min($num,$conf->liste_limit))
 	{
 		$obj = $db->fetch_object($resql);

+ 1 - 1
htdocs/commande/apercu.php

@@ -129,7 +129,7 @@ if ($id > 0 || ! empty($ref))
 			print '</tr>';
 
 			// Si fichier detail PDF existe
-			// TODO obsolete ?
+			// TODO deprecated ?
 			if (file_exists($filedetail))
 			{
 				print "<tr ".$bc[$var]."><td>Commande detaillee</td>";

+ 34 - 14
htdocs/commande/class/commande.class.php

@@ -74,17 +74,15 @@ class Commande extends CommonOrder
 
 	/**
 	 * Status of the order. Check the following constants:
-	 * - STATUS_CANCELED
-	 * - STATUS_DRAFT
-	 * - STATUS_ACCEPTED
-	 * - STATUS_CLOSED
 	 * @var int
+	 * @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED
 	 */
     var $statut;
 	/**
 	 * @deprecated
+	 * @see billed
 	 */
-    var $facturee;		// deprecated
+    var $facturee;
     var $billed;		// billed or not
 
     var $brouillon;
@@ -100,7 +98,11 @@ class Commande extends CommonOrder
     var $fk_delivery_address;
     var $address;
     var $date;				// Date commande
-    var $date_commande;		// Date commande (deprecated)
+	/**
+	 * @deprecated
+	 * @see date
+	 */
+    var $date_commande;
     var $date_livraison;	// Date livraison souhaitee
     var $shipping_method_id;
     var $fk_remise_except;
@@ -116,7 +118,11 @@ class Commande extends CommonOrder
     var $rang;
     var $special_code;
     var $source;			// Origin of order
-    var $note;				// deprecated
+	/**
+	 * @deprecated
+	 * @see note_private, note_public
+	 */
+    var $note;
     var $note_private;
     var $note_public;
     var $extraparams=array();
@@ -1033,7 +1039,9 @@ class Commande extends CommonOrder
      */
     function createFromProposal($object)
     {
-        global $conf,$user,$langs,$hookmanager;
+        global $db, $conf,$user,$langs,$hookmanager;
+
+		dol_include_once('/core/class/extrafields.class.php');
 
         $error=0;
 
@@ -1104,9 +1112,15 @@ class Commande extends CommonOrder
 
             // get extrafields from original line
 			$object->fetch_optionals($object->id);
-			foreach($object->array_options as $options_key => $value)
-				$this->array_options[$options_key] = $value;
-
+			
+			$e = new ExtraFields($db);
+			$element_extrafields = $e->fetch_name_optionals_label($this->element);
+			
+			foreach($object->array_options as $options_key => $value) {
+				if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){
+					$this->array_options[$options_key] = $value;
+				}
+			}
             // Possibility to add external linked objects with hooks
             $this->linked_objects[$this->origin] = $this->origin_id;
             if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
@@ -1728,6 +1742,7 @@ class Commande extends CommonOrder
 
                 $i++;
             }
+
             $this->db->free($result);
 
             return 1;
@@ -1776,7 +1791,7 @@ class Commande extends CommonOrder
      *	@param      int		$filtre_statut      Filter on status
      * 	@return     int                			<0 if KO, Nb of lines found if OK
      *
-     *	TODO deprecated, move to Shipping class
+     *	TODO deprecate, move to Shipping class
      */
     function loadExpeditions($filtre_statut=-1)
     {
@@ -1823,7 +1838,7 @@ class Commande extends CommonOrder
      *
      * @return	int		Nb of shipments
      *
-     * TODO deprecated, move to Shipping class
+     * TODO deprecate, move to Shipping class
      */
     function nb_expedition()
     {
@@ -1849,7 +1864,7 @@ class Commande extends CommonOrder
      *	@param      int		$filtre_statut      Filtre sur statut
      *	@return     int                 		0 si OK, <0 si KO
      *
-     *	TODO  deprecated, move to Shipping class
+     *	TODO  deprecate, move to Shipping class
      */
     function livraison_array($filtre_statut=self::STATUS_CANCELED)
     {
@@ -2399,9 +2414,12 @@ class Commande extends CommonOrder
 	 *
 	 * @return     int     <0 if ko, >0 if ok
 	 * @deprecated
+	 * @see classifyBilled()
 	 */
 	function classer_facturee()
 	{
+		dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 		return $this->classifyBilled();
 	}
 
@@ -3346,6 +3364,7 @@ class OrderLine extends CommonOrderLine
 	 * Id of parent order
 	 * @var int
 	 * @deprecated Use fk_commande
+	 * @see fk_commande
 	 */
 	public $commande_id;
 
@@ -3367,6 +3386,7 @@ class OrderLine extends CommonOrderLine
 
 	/**
 	 * @deprecated
+	 * @see remise_percent, fk_remise_except
 	 */
 	var $remise;
 

+ 6 - 0
htdocs/compta/bank/class/account.class.php

@@ -41,6 +41,7 @@ class Account extends CommonObject
     /**
      * @var	int		Use id instead of rowid
      * @deprecated
+     * @see id
      */
     var $rowid;
     var $id;
@@ -240,6 +241,11 @@ class Account extends CommonObject
      */
     function addline($date, $oper, $label, $amount, $num_chq, $categorie, $user, $emetteur='',$banque='')
     {
+	    // Deprecatîon warning
+	    if (is_numeric($oper)) {
+		    dol_syslog(__METHOD__ . ": using numeric operations is deprecated", LOG_WARNING);
+	    }
+
         // Clean parameters
         $emetteur=trim($emetteur);
         $banque=trim($banque);

+ 5 - 1
htdocs/compta/deplacement/class/deplacement.class.php

@@ -44,7 +44,11 @@ class Deplacement extends CommonObject
 	var $fk_user_author;
 	var $fk_user;
 	var $km;
-	var $note;			// TODO obsolete
+	/**
+	 * @deprecated
+	 * @see note_private, note_public
+	 */
+	var $note;			// TODO deprecated
 	var $note_private;
 	var $note_public;
 	var $socid;

+ 30 - 7
htdocs/compta/facture/class/facture.class.php

@@ -92,18 +92,16 @@ class Facture extends CommonInvoice
 	var $revenuestamp;
 	/**
 	 * @deprecated
+	 * @see note_private, note_public
 	 */
 	var $note;
 	var $note_private;
 	var $note_public;
 
 	/**
-	 * Check constants for more info:
-	 * - STATUS_DRAFT
-	 * - STATUS_VALIDATED
-	 * - STATUS_PAID
-	 * - STATUS_ABANDONED
+	 * Invoice status
 	 * @var int
+	 * @see Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_PAID, Facture::STATUS_ABANDONED
 	 */
 	var $statut;
 	//! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon
@@ -131,6 +129,9 @@ class Facture extends CommonInvoice
 	 * @deprecated
 	 */
 	var $products=array();
+	/**
+	 * @var FactureLigne[]
+	 */
 	var $lines=array();
 	var $line;
 	var $extraparams=array();
@@ -1119,7 +1120,8 @@ class Facture extends CommonInvoice
 				$objp = $this->db->fetch_object($result);
 				$line = new FactureLigne($this->db);
 
-				$line->rowid	        = $objp->rowid;
+				$line->id               = $objp->rowid;
+				$line->rowid	        = $objp->rowid;             // deprecated
 				$line->label            = $objp->custom_label;		// deprecated
 				$line->desc             = $objp->description;		// Description line
 				$line->product_type     = $objp->product_type;		// Type of line
@@ -2105,6 +2107,11 @@ class Facture extends CommonInvoice
 	 */
 	function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_options=0, $situation_percent=100, $fk_prev_id='', $fk_unit = null)
 	{
+		// Deprecation warning
+		if ($label) {
+			dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING);
+		}
+
 		global $mysoc, $conf, $langs;
 
 		dol_syslog(get_class($this)."::addline facid=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG);
@@ -2289,6 +2296,11 @@ class Facture extends CommonInvoice
 	 */
 	function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null)
 	{
+		// Deprecation warning
+		if ($label) {
+			dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING);
+		}
+
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
 
 		global $mysoc;
@@ -3685,7 +3697,10 @@ class FactureLigne extends CommonInvoiceLine
 	var $fk_facture;
 	//! Id parent line
 	var $fk_parent_line;
-	var $label;				// deprecated
+	/**
+	 * @deprecated
+	 */
+	var $label;
 	//! Description ligne
 	var $desc;
 
@@ -3717,8 +3732,16 @@ class FactureLigne extends CommonInvoiceLine
 	//var $remise;			// Montant calcule de la remise % sur PU HT (exemple 20)
 
 	// From llx_product
+	/**
+	 * @deprecated
+	 * @see product_ref
+	 */
 	var $ref;				// Product ref (deprecated)
 	var $product_ref;       // Product ref
+	/**
+	 * @deprecated
+	 * @see product_label
+	 */
 	var $libelle;      		// Product label (deprecated)
 	var $product_label;     // Product label
 	var $product_desc;  	// Description produit

+ 1 - 0
htdocs/compta/facture/document.php

@@ -37,6 +37,7 @@ $langs->load('propal');
 $langs->load('compta');
 $langs->load('other');
 $langs->load("bills");
+$langs->load('companies');
 
 
 $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int'));  // For backward compatibility

+ 2 - 1
htdocs/compta/facture/prelevement.php

@@ -36,6 +36,7 @@ if (!$user->rights->facture->lire) accessforbidden();
 $langs->load("bills");
 $langs->load("banks");
 $langs->load("withdrawals");
+$langs->load('companies');
 
 $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int'));  // For backward compatibility
 $ref=GETPOST('ref','alpha');
@@ -396,7 +397,7 @@ if ($object->id > 0)
 	}
 	print "</td>";
 	print '</tr>';
-	
+
 	// Montants
 	print '<tr><td>'.$langs->trans('AmountHT').'</td>';
 	print '<td align="right" colspan="2" class="nowrap">'.price($object->total_ht).'</td>';

+ 10 - 1
htdocs/compta/paiement/class/paiement.class.php

@@ -40,7 +40,16 @@ class Paiement extends CommonObject
 	var $ref;
 	var $facid;
 	var $datepaye;
-    var $total;             // deprecated
+	/**
+	 * @deprecated
+	 * @see amount, amounts
+	 */
+    var $total;
+	/**
+	 * @deprecated
+	 * @see amount, amounts
+	 */
+	var $montant;
 	var $amount;            // Total amount of payment
 	var $amounts=array();   // Array of amounts
 	var $author;

+ 5 - 0
htdocs/compta/sociales/class/paymentsocialcontribution.class.php

@@ -40,6 +40,11 @@ class PaymentSocialContribution extends CommonObject
 	var $datec='';
 	var $tms='';
 	var $datep='';
+	/**
+	 * @deprecated
+	 * @see amount
+	 */
+	var $total;
     var $amount;            // Total amount of payment
     var $amounts=array();   // Array of amounts
 	var $fk_typepaiement;

+ 2 - 0
htdocs/contact/canvas/actions_contactcard_common.class.php

@@ -51,6 +51,8 @@ abstract class ActionsContactCardCommon
 	 */
 	private function getInstanceDao()
 	{
+		dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 		if (! is_object($this->object))
 		{
 			$modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php');

+ 10 - 8
htdocs/contact/card.php

@@ -201,12 +201,12 @@ if (empty($reshook))
 
         // Fill array 'array_options' with data from add form
 		$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
-		if ($ret < 0) 
+		if ($ret < 0)
 		{
 			$error++;
 			$action = 'create';
 		}
-		
+
         if (! GETPOST("lastname"))
         {
             $error++; $errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label"));
@@ -1105,18 +1105,14 @@ else
 		{
         	if ($user->rights->societe->contact->creer)
             {
-                print '<a class="butAction" href="card.php?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
+                print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
             }
 
             if (! $object->user_id && $user->rights->user->user->creer)
             {
-                print '<a class="butAction" href="card.php?id='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>';
+                print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>';
             }
 
-            if ($user->rights->societe->contact->supprimer)
-            {
-                print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete'.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.$langs->trans('Delete').'</a>';
-            }
             // Activer
             if ($object->statut == 0 && $user->rights->societe->contact->creer)
             {
@@ -1126,6 +1122,12 @@ else
             if ($object->statut == 1 && $user->rights->societe->contact->creer)
             {
                 print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&id='.$object->id.'">'.$langs->trans("DisableUser").'</a>';
+            }
+
+		    // Delete
+		    if ($user->rights->societe->contact->supprimer)
+            {
+                print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete'.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.$langs->trans('Delete').'</a>';
             }
         }
 

+ 20 - 4
htdocs/contact/class/contact.class.php

@@ -50,9 +50,21 @@ class Contact extends CommonObject
 	var $zip;
 	var $town;
 
-	var $fk_departement;		// deprecated
-	var $departement_code;		// deprecated
-	var $departement;			// deprecated
+	/**
+	 * @deprecated
+	 * @see state_id
+	 */
+	var $fk_departement;
+	/**
+	 * @deprecated
+	 * @see state_code
+	 */
+	var $departement_code;
+	/**
+	 * @deprecated
+	 * @see state
+	 */
+	var $departement;
 	var $state_id;	        	// Id of department
 	var $state_code;		    // Code of department
 	var $state;			        // Label of department
@@ -80,7 +92,11 @@ class Contact extends CommonObject
 	var $birthday;
 	var $default_lang;
     var $note_public;           // Public note
-	var $note;                  // deprecated
+	/**
+	 * @deprecated
+	 * @see note_public, note_private
+	 */
+	var $note;
 	var $note_private;			// Private note
     var $no_email;				// 1=Don't send e-mail to this contact, 0=do
 

+ 2 - 1
htdocs/contact/document.php

@@ -80,8 +80,9 @@ llxHeader("",$langs->trans("Contact"), $helpurl);
 if ($object->id)
 {
     $head = contact_prepare_head($object);
+	$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
 
-    dol_fiche_head($head, 'documents',  $langs->trans("Contact"), 0, 'contact');
+    dol_fiche_head($head, 'documents', $title, 0, 'contact');
 
 
     // Construit liste des fichiers

+ 5 - 0
htdocs/contrat/class/contrat.class.php

@@ -154,6 +154,7 @@ class Contrat extends CommonObject
 
 	/**
 	 * @deprecated Use fk_project instead
+	 * @see fk_project
 	 */
 	var $fk_projet;
 
@@ -1642,6 +1643,8 @@ class Contrat extends CommonObject
 	 */
 	function update_statut($user)
 	{
+		dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 		// If draft, we keep it (should not happen)
 		if ($this->statut == 0) return 1;
 
@@ -2165,6 +2168,7 @@ class ContratLigne extends CommonObjectLine
 	/**
 	 * @var string
 	 * @deprecated Use $label instead
+	 * @see label
 	 */
 	public $libelle;
 
@@ -2189,6 +2193,7 @@ class ContratLigne extends CommonObjectLine
 	/**
 	 * @var float
 	 * @deprecated Use $price_ht instead
+	 * @see price_ht
 	 */
 	public $price;
 

+ 1 - 0
htdocs/core/class/commondocgenerator.class.php

@@ -118,6 +118,7 @@ abstract class CommonDocGenerator
             'mycompany_idprof5'=>$mysoc->idprof5,
             'mycompany_idprof6'=>$mysoc->idprof6,
         	'mycompany_vatnumber'=>$mysoc->tva_intra,
+			'mycompany_object'=>$mysoc->object,
         	// Only private not exists for "mysoc"
             'mycompany_note_private'=>$mysoc->note_private,
 

+ 36 - 14
htdocs/core/class/commonobject.class.php

@@ -7,7 +7,7 @@
  * Copyright (C) 2012-2013 Christophe Battarel  <christophe.battarel@altairis.fr>
  * Copyright (C) 2011-2014 Philippe Grand	    <philippe.grand@atoo-net.com>
  * Copyright (C) 2012-2015 Marcos García        <marcosgdf@gmail.com>
- * Copyright (C) 2012-2014 Raphaël Doursenaud   <rdoursenaud@gpcsolutions.fr>
+ * Copyright (C) 2012-2015 Raphaël Doursenaud   <rdoursenaud@gpcsolutions.fr>
  * Copyright (C) 2012      Cedric Salvador      <csalvador@gpcsolutions.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -44,6 +44,7 @@ abstract class CommonObject
     /**
      * @var string 		Error string
      * @deprecated		Use instead the array of error strings
+     * @see             errors
      */
     public $error;
 
@@ -82,7 +83,7 @@ abstract class CommonObject
     public $errors=array();
 
     /**
-     * @var string		Can be used to pass information when only object is provided to method
+     * @var string[]	Can be used to pass information when only object is provided to method
      */
     public $context=array();
 
@@ -96,7 +97,24 @@ abstract class CommonObject
     public $lastname;
     public $firstname;
     public $civility_id;
+	/**
+	 * @deprecated
+	 * @see thirdparty
+	 */
+	public $client;
+	/**
+	 * @var Societe
+	 */
     public $thirdparty;
+	/**
+	 * @deprecated
+	 * @see project
+	 */
+	public $projet;
+	/**
+	 * @var Project
+	 */
+	public $project;
 
     // No constructor as it is an abstract class
 
@@ -113,13 +131,15 @@ abstract class CommonObject
      */
     static function isExistingObject($element, $id, $ref='', $ref_ext='')
     {
-    	global $db;
+    	global $db,$conf;
 
 		$sql = "SELECT rowid, ref, ref_ext";
 		$sql.= " FROM ".MAIN_DB_PREFIX.$element;
-		if ($id > 0) $sql.= " WHERE rowid = ".$db->escape($id);
-		else if ($ref) $sql.= " WHERE ref = '".$db->escape($ref)."'";
-		else if ($ref_ext) $sql.= " WHERE ref_ext = '".$db->escape($ref_ext)."'";
+		$sql.= " WHERE entity IN (".getEntity($element).")" ; 
+		
+		if ($id > 0) $sql.= " AND rowid = ".$db->escape($id);
+		else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'";
+		else if ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'";
 		else {
 			$error='ErrorWrongParameters';
 			dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR);
@@ -1643,9 +1663,10 @@ abstract class CommonObject
     /**
      * 	Update public note (kept for backward compatibility)
      *
-     *  @param      string		$note		New value for note
-     *  @return     int      		   		<0 if KO, >0 if OK
-     *  @deprecated
+     * @param      string		$note		New value for note
+     * @return     int      		   		<0 if KO, >0 if OK
+     * @deprecated
+     * @see update_note()
      */
     function update_note_public($note)
     {
@@ -3960,15 +3981,16 @@ abstract class CommonObject
 	 * This function is meant to be called from replaceThirdparty with the appropiate tables
 	 * Column name fk_soc MUST be used to identify thirdparties
 	 *
-	 * @param DoliDB $db Database handler
-	 * @param int $origin_id Old thirdparty id
-	 * @param int $dest_id New thirdparty id
-	 * @param array $tables Tables that need to be changed
+	 * @param DoliDB 	$db 			Database handler
+	 * @param int 		$origin_id 		Old thirdparty id (the thirdparty to delete)
+	 * @param int 		$dest_id 		New thirdparty id (the thirdparty that will received element of the other)
+	 * @param array 	$tables 		Tables that need to be changed
 	 * @return bool
 	 */
 	public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables)
 	{
-		foreach ($tables as $table) {
+		foreach ($tables as $table)
+		{
 			$sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id;
 
 			if (!$db->query($sql)) {

+ 1 - 0
htdocs/core/class/commonobjectline.class.php

@@ -39,6 +39,7 @@ abstract class CommonObjectLine extends CommonObject
 	 * Id of the line
 	 * @var int
 	 * @deprecated Try to use id property as possible (even if field into database is still rowid)
+	 * @see id
 	 */
 	public $rowid;
 

+ 4 - 0
htdocs/core/class/commonorder.class.php

@@ -43,6 +43,7 @@ abstract class CommonOrderLine extends CommonObjectLine
 	 * Product ref
 	 * @var string
 	 * @deprecated Use product_ref
+	 * @see product_ref
 	 */
 	public $ref;
 
@@ -56,6 +57,7 @@ abstract class CommonOrderLine extends CommonObjectLine
 	 * Product label
 	 * @var string
 	 * @deprecated Use product_label
+	 * @see product_label
 	 */
 	public $libelle;
 
@@ -78,7 +80,9 @@ abstract class CommonOrderLine extends CommonObjectLine
 	public $qty;
 
 	/**
+	 * Unit price
 	 * @deprecated
+	 * @see subprice
 	 */
 	var $price;
 

+ 37 - 20
htdocs/core/class/html.form.class.php

@@ -859,6 +859,7 @@ class Form
      *	@param	int		$limit			Maximum number of elements
      * 	@return	string					HTML string with
 	 *  @deprecated						Use select_thirdparty instead
+     *  @see select_thirdparty()
      */
     function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0)
     {
@@ -1228,6 +1229,7 @@ class Form
      *  @param	int		$force_entity	0 or Id of environment to force
      * 	@return	void
      *  @deprecated
+     *  @see select_dolusers()
      */
     function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0)
     {
@@ -1466,7 +1468,7 @@ class Form
 		$assignedtouser=array();
 		if (!empty($_SESSION['assignedtouser']))
 		{
-			$assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
+			$assignedtouser=json_decode($_SESSION['assignedtouser'], true);
 		}
 		$nbassignetouser=count($assignedtouser);
 
@@ -3035,6 +3037,7 @@ class Form
      *     @param	int			$width				Force width of box
      *     @return 	void
      *     @deprecated
+     *     @see formconfirm()
      */
     function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500)
     {
@@ -3092,7 +3095,7 @@ class Form
 
         	// Now add questions
             $more.='<table class="paddingrightonly" width="100%">'."\n";
-            $more.='<tr><td colspan="3" valign="top">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n";
+            $more.='<tr><td colspan="3">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n";
             foreach ($formquestion as $key => $input)
             {
                 if (is_array($input) && ! empty($input))
@@ -3101,15 +3104,15 @@ class Form
 
                     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.' value="'.$input['value'].'" /></td></tr>'."\n";
+                        $more.='<tr><td>'.$input['label'].'</td><td 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')
                     {
-                        $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";
+                        $more.='<tr><td>'.$input['label'].'</td><td 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')
                     {
-                        $more.='<tr><td valign="top">';
+                        $more.='<tr><td>';
                         if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">';
                         $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1);
                         $more.='</td></tr>'."\n";
@@ -3117,13 +3120,13 @@ class Form
                     else if ($input['type'] == 'checkbox')
                     {
                         $more.='<tr>';
-                        $more.='<td valign="top">'.$input['label'].' </td><td valign="top" align="left">';
+                        $more.='<td>'.$input['label'].' </td><td align="left">';
                         $more.='<input type="checkbox" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"';
                         if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked';
                         if (is_bool($input['value']) && $input['value']) $more.=' checked';
                         if (isset($input['disabled'])) $more.=' disabled';
                         $more.=' /></td>';
-                        $more.='<td valign="top" align="left">&nbsp;</td>';
+                        $more.='<td align="left">&nbsp;</td>';
                         $more.='</tr>'."\n";
                     }
                     else if ($input['type'] == 'radio')
@@ -3134,10 +3137,10 @@ class Form
                             $more.='<tr>';
                             if ($i==0) $more.='<td valign="top">'.$input['label'].'</td>';
                             else $more.='<td>&nbsp;</td>';
-                            $more.='<td valign="top" width="20"><input type="radio" class="flat" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"';
+                            $more.='<td width="20"><input type="radio" class="flat" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"';
                             if ($input['disabled']) $more.=' disabled';
                             $more.=' /></td>';
-                            $more.='<td valign="top" align="left">';
+                            $more.='<td align="left">';
                             $more.=$selval;
                             $more.='</td></tr>'."\n";
                             $i++;
@@ -3145,8 +3148,8 @@ class Form
                     }
                     else if ($input['type'] == 'other')
                     {
-                        $more.='<tr><td valign="top">';
-                        if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">';
+                        $more.='<tr><td>';
+                        if (! empty($input['label'])) $more.=$input['label'].'</td><td colspan="2" align="left">';
                         $more.=$input['value'];
                         $more.='</td></tr>'."\n";
                     }
@@ -4734,33 +4737,47 @@ class Form
         //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
         $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
 
-        $previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):'&nbsp;').'</a>':'';
-        $next_ref     = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):'&nbsp;').'</a>':'';
+        //$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):'&nbsp;').'</a>':'';
+        //$next_ref     = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):'&nbsp;').'</a>':'';
+        $previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?'<':'&nbsp;').'</a>':'';
+        $next_ref     = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?'>':'&nbsp;').'</a>':'';
 
         //print "xx".$previous_ref."x".$next_ref;
-        if ($previous_ref || $next_ref || $morehtml) {
-            $ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
-        }
+        //if ($previous_ref || $next_ref || $morehtml) {
+            //$ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
+            $ret.='<div style="vertical-align: middle"><div class="inline-block floatleft refid">';
+        //}
 
         $ret.=dol_htmlentities($object->$fieldref);
         if ($morehtmlref)
         {
             $ret.=' '.$morehtmlref;
         }
+			$ret.='</div>';
 
+        if ($previous_ref || $next_ref || $morehtml)
+        {
+        	$ret.='<div class="pagination"><ul>';
+        }
         if ($morehtml)
         {
-            $ret.='</td><td class="paddingrightonly" align="right">'.$morehtml;
+            //$ret.='</td><td class="paddingrightonly" align="right">'.$morehtml;
+            $ret.='<li class="noborder litext">'.$morehtml.'</li>';
         }
         if ($shownav && ($previous_ref || $next_ref))
         {
-            $ret.='</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td>';
-            $ret.='<td class="nobordernopadding" align="center" width="20">'.$next_ref;
+            //$ret.='</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td>';
+            //$ret.='<td class="nobordernopadding" align="center" width="20">'.$next_ref;
+            $ret.='<li class="pagination">'.$previous_ref.'</li>';
+            $ret.='<li class="pagination">'.$next_ref.'</li>';
         }
         if ($previous_ref || $next_ref || $morehtml)
         {
-            $ret.='</td></tr></table>';
+            //$ret.='</td></tr></table>';
+            $ret.='</ul></div>';
         }
+		$ret.='</div>';
+
         return $ret;
     }
 

+ 1 - 0
htdocs/core/class/html.formcompany.class.php

@@ -423,6 +423,7 @@ class FormCompany
 	 *    @param    string		$filter          	Add a SQL filter on list
 	 *    @return	void
 	 *    @deprecated Use print xxx->select_juridicalstatus instead
+	 *    @see select_juridicalstatus()
 	 */
 	function select_forme_juridique($selected='', $country_codeid=0, $filter='')
 	{

+ 6 - 1
htdocs/core/class/html.formfile.class.php

@@ -249,7 +249,7 @@ class FormFile
      *      @param      string				$modelselected      Model to preselect by default
      *      @param      string				$allowgenifempty	Allow generation even if list of template ($genallowed) is empty (show however a warning)
      *      @param      string				$forcenomultilang	Do not show language option (even if MAIN_MULTILANGS defined)
-     *      @param      int					$iconPDF            Obsolete, see getDocumentsLink
+     *      @param      int					$iconPDF            Deprecated, see getDocumentsLink
      * 		@param		int					$maxfilenamelength	Max length for filename shown
      * 		@param		string				$noform				Do not output html form tags
      * 		@param		string				$param				More param on http links
@@ -261,6 +261,11 @@ class FormFile
      */
     function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='')
     {
+		// Deprecation warning
+		if (0 !== $iconPDF) {
+			dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING);
+		}
+
         global $langs, $conf, $user, $hookmanager;
         global $form, $bc;
 

+ 10 - 1
htdocs/core/class/html.formmail.class.php

@@ -48,7 +48,16 @@ class FormMail extends Form
 
     var $withsubstit;			// Show substitution array
     var $withfrom;
-    var $withto;				// Show recipient emails
+	/**
+	 * @var int
+	 * @deprecated Fill withto with array before calling method.
+	 * @see withto
+	 */
+	public $withtosocid;
+	/**
+	 * @var int|int[]
+	 */
+    public $withto;				// Show recipient emails
     var $withtofree;			// Show free text for recipient emails
     var $withtocc;
     var $withtoccc;

+ 6 - 0
htdocs/core/class/html.formother.class.php

@@ -592,6 +592,7 @@ class FormOther
      * 		@param 	array		$arrayofcolors	Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
      * 		@return	void
      * 		@deprecated
+     *      @see selectColor()
      */
     function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='')
     {
@@ -611,6 +612,11 @@ class FormOther
      */
     function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='')
     {
+	    // Deprecation warning
+	    if ($form_name) {
+		    dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING);
+	    }
+
         global $langs,$conf;
 
         $out='';

+ 1 - 0
htdocs/core/class/translate.class.php

@@ -707,6 +707,7 @@ class Translate
 	 *  @param	string	$amount				If not '', show currency + amount according to langs ($10, 10€).
 	 *  @return	string						Amount + Currency symbol encoded into UTF8
 	 *  @deprecated							Use method price to output a price
+	 *  @see price()
 	 */
 	function getCurrencyAmount($currency_code, $amount)
 	{

+ 3 - 3
htdocs/core/lib/date.lib.php

@@ -278,8 +278,8 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt
  *	                 			YYYYMMDDHHMMSS
  *								YYYYMMDDTHHMMSSZ
  *								YYYY-MM-DDTHH:MM:SSZ (RFC3339)
- *		                		DD/MM/YY or DD/MM/YYYY (this format should not be used anymore)
- *		                		DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (this format should not be used anymore)
+ *		                		DD/MM/YY or DD/MM/YYYY (deprecated)
+ *		                		DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated)
  *  @param	int		$gm         1 =Input date is GM date,
  *                              0 =Input date is local date using PHP server timezone
  *  @return	int					Date as a timestamp
@@ -292,7 +292,7 @@ function dol_stringtotime($string, $gm=1)
     // Convert date with format DD/MM/YYY HH:MM:SS. This part of code should not be used.
     if (preg_match('/^([0-9]+)\/([0-9]+)\/([0-9]+)\s?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$string,$reg))
     {
-        dol_syslog("dol_stringtotime call to function with deprecated parameter", LOG_WARNING);
+        dol_syslog("dol_stringtotime call to function with deprecated parameter format", LOG_WARNING);
         // Date est au format 'DD/MM/YY' ou 'DD/MM/YY HH:MM:SS'
         // Date est au format 'DD/MM/YYYY' ou 'DD/MM/YYYY HH:MM:SS'
         $sday = $reg[1];

+ 5 - 6
htdocs/core/lib/donation.lib.php

@@ -24,15 +24,14 @@
 /**
  *	Prepare array with list of admin tabs
  *
- *	@param	Donation	$object		Donation
  *	@return	array					Array of tabs to show
  */
-function donation_admin_prepare_head($object)
+function donation_admin_prepare_head()
 {
 	global $langs, $conf;
 
 	$h = 0;
-	$head = array ();
+	$head = array();
 
 	$head[$h][0] = DOL_URL_ROOT . '/don/admin/donation.php';
 	$head[$h][1] = $langs->trans("Miscellaneous");
@@ -43,14 +42,14 @@ function donation_admin_prepare_head($object)
 	// Entries must be declared in modules descriptor with line
 	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
 	// $this->tabs = array('entity:-tabname); to remove a tab
-	complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation_admin');
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin');
 	
 	$head[$h][0] = DOL_URL_ROOT . '/don/admin/donation_extrafields.php';
 	$head[$h][1] = $langs->trans("ExtraFields");
     $head[$h][2] = 'attributes';
 	$h++;
 
-	complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation_admin', 'remove');
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'donation_admin', 'remove');
 
 	return $head;
 }
@@ -66,7 +65,7 @@ function donation_prepare_head($object)
 	global $langs, $conf;
 
 	$h = 0;
-	$head = array ();
+	$head = array();
 
 	$head[$h][0] = DOL_URL_ROOT . '/don/card.php?id=' . $object->id;
 	$head[$h][1] = $langs->trans("Card");

+ 42 - 4
htdocs/core/lib/functions.lib.php

@@ -45,10 +45,13 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php';
  * @param	string 	$class		Class name
  * @param 	string 	$member		Name of property
  * @return 	mixed				Return value of static property
- * @deprecated Dolibarr now requires 5.3.0+
+ * @deprecated Dolibarr now requires 5.3.0+, use $class::$property syntax
+ * @see https://php.net/manual/language.oop5.static.php
  */
 function getStaticMember($class, $member)
 {
+	dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
+
 	// This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member
 	/*if (version_compare(phpversion(), '5.3.0', '<'))
 	{
@@ -387,11 +390,12 @@ function dol_buildpath($path, $type=0)
  *
  * 	@param	object	$object		Object to clone
  *	@return object				Object clone
- *  @deprecated Dolibarr no longer supports PHP4, you can now use native function
+ *  @deprecated Dolibarr no longer supports PHP4, use PHP5 native clone construct
+ *  @see https://php.net/manual/language.oop5.cloning.php
  */
 function dol_clone($object)
 {
-	dol_syslog("Functions.lib::dol_clone Clone object");
+	dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
 
 	$myclone=clone($object);
 	return $myclone;
@@ -831,6 +835,25 @@ function dol_get_fiche_end($notab=0)
 	else return '';
 }
 
+/**
+ * Show a string with the label tag dedicated to the HTML edit field.
+ *
+ * @param	string	$langkey		Translation key
+ * @param 	string	$fieldkey		Key of the html select field the text refers to
+ * @param	int		$fieldrequired	1=Field is mandatory
+ */
+function fieldLabel($langkey, $fieldkey, $fieldrequired=0)
+{
+	global $conf, $langs;
+	$ret='';
+	if ($fieldrequired) $ret.='<span class="fieldrequired">';
+	if (empty($conf->dol_use_jmobile)) $ret.='<label for="'.$fieldkey.'">';
+	$ret.=$langs->trans($langkey);
+	if (empty($conf->dol_use_jmobile)) $ret.='</label>';
+	if ($fieldrequired) $ret.='</span>';
+	return $ret;
+}
+
 /**
  * Return string to add class property on html element with pair/impair.
  *
@@ -1702,11 +1725,15 @@ function dol_substr($string,$start,$length,$stringencoding='')
  *  @param		string	$url			Param to add an url to click values
  *  @return		void
  *  @deprecated
+ *  @see DolGraph
  */
 function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='')
 {
+	dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
+
 	global $conf,$langs;
 	global $theme_datacolor;    // To have var kept when function is called several times
+
 	if (empty($conf->use_javascript_ajax)) return;
 	$jsgraphlib='flot';
 	$datacolor=array();
@@ -2380,9 +2407,12 @@ function img_mime($file, $titlealt = '')
  *	@param  int		$option		Option
  *	@return string      		Return img tag
  *  @deprecated
+ *  @see img_picto
  */
 function img_phone($titlealt = 'default', $option = 0)
 {
+	dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
+
 	global $conf,$langs;
 
 	if ($titlealt == 'default') $titlealt = $langs->trans('Call');
@@ -2452,7 +2482,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv=0)
 		return img_picto($text, 'info', 'class="hideonsmartphone"');
 	}
 
-	return ($nodiv?'':'<div class="info hideonsmartphone">').img_picto($langs->trans('InfoAdmin'), 'info', 'class="hideonsmartphone"').' '.$text.($nodiv?'':'</div>');
+	return ($nodiv?'':'<div class="info hideonsmartphone">').img_picto($langs->trans('InfoAdmin'), ($nodiv?'info':'info_black'), 'class="hideonsmartphone"').' '.$text.($nodiv?'':'</div>');
 }
 
 
@@ -2702,9 +2732,12 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
  *	@param	string	$title			Title to show
  *	@return	string					Title to show
  *  @deprecated						Use print_fiche_titre instead
+ *  @see print_fiche_titre
  */
 function print_titre($title)
 {
+	dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
+
 	print '<div class="titre">'.$title.'</div>';
 }
 
@@ -4060,9 +4093,12 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
  *
  * @return		float		Time (millisecondes) with microsecondes in decimal part
  * @deprecated Dolibarr does not support PHP4, you should use native function
+ * @see microtime()
  */
 function dol_microtime_float()
 {
+	dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
+
 	return microtime(true);
 }
 
@@ -4282,6 +4318,8 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
  */
 function setEventMessage($mesgs, $style='mesgs')
 {
+	dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
+
 	if (! is_array($mesgs))		// If mesgs is a string
 	{
 		if ($mesgs) $_SESSION['dol_events'][$style][] = $mesgs;

+ 2 - 0
htdocs/core/lib/json.lib.php

@@ -42,6 +42,7 @@ if (! function_exists('json_encode'))
  *
  * @param	mixed	$elements		PHP Object to json encode
  * @return 	string					Json encoded string
+ * @deprecated PHP >= 5.3 supports native json_encode
  */
 function dol_json_encode($elements)
 {
@@ -219,6 +220,7 @@ if (! function_exists('json_decode'))
  * @param	string	$json		Json encoded to PHP Object or Array
  * @param	bool	$assoc		False return an object, true return an array. Try to always use it with true !
  * @return 	mixed				Object or Array or false on error
+ * @deprecated PHP >= 5.3 supports native json_decode
  */
 function dol_json_decode($json, $assoc=false)
 {

+ 2 - 2
htdocs/core/menus/init_menu_auguria.sql

@@ -224,8 +224,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2721__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyyear.php', 'ByYear', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 0, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2722__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/balancebymonth.php', 'AccountBalanceByMonth', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 1, __ENTITY__);
 -- Fiscal year & Chart of accounts
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled"', __HANDLER__, 'left', 2750__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'main', '$user->rights->accounting->fiscalyear', '', 2, 20, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled"', __HANDLER__, 'left', 2751__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'main', '$user->rights->accounting->chartofaccount', '', 2, 21, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2750__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'accountancy', '$user->rights->accounting->fiscalyear', '', 2, 20, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2751__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 2, 21, __ENTITY__);
 -- Check deposit
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?leftmenu=checks&amp;mainmenu=bank', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?leftmenu=checks&amp;action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__);

+ 2 - 2
htdocs/core/menus/standard/eldy.lib.php

@@ -589,13 +589,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
 			{
 				$langs->load("commercial");
 				$newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects');
-
+				/* no more required, there is a filter that can do more
 				if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
 				if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
 				if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
 				if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
 				if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
-
+				*/
 				$newmenu->add("/societe/soc.php?leftmenu=prospects&amp;action=create&amp;type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer);
 				//$newmenu->add("/contact/list.php?leftmenu=customers&amp;type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
 			}

+ 1 - 0
htdocs/core/modules/DolibarrModules.class.php

@@ -42,6 +42,7 @@ abstract class DolibarrModules
     /**
      * @var string Relative path to module style sheet
      * @deprecated
+     * @see module_parts
      */
     public $style_sheet = '';
 

+ 4 - 1
htdocs/core/modules/askpricesupplier/modules_askpricesupplier.php

@@ -156,10 +156,13 @@ abstract class ModeleNumRefAskPriceSupplier
  *  @param      int			$hidedesc       Hide description
  *  @param      int			$hideref        Hide ref
  * 	@return     int         				0 if KO, 1 if OK
- * @deprecated Use the new function generateDocument of Propal class
+ * @deprecated Use the new function generateDocument of AskPriceSupplier class
+ * @see AskPriceSupplier::generateDocument()
  */
 function askpricesupplier_pdf_create(DoliDB $db, AskPriceSupplier $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
 }
 

+ 3 - 0
htdocs/core/modules/commande/modules_commande.php

@@ -161,8 +161,11 @@ abstract class ModeleNumRefCommandes
  *  @param      int			$hideref        Hide ref
  *  @return     int         				0 if KO, 1 if OK
  *  @deprecated Use the new function generateDocument of Commande class
+ *  @see Commande::generateDocument()
  */
 function commande_pdf_create(DoliDB $db, Commande $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
 }

+ 3 - 0
htdocs/core/modules/contract/modules_contract.php

@@ -156,8 +156,11 @@ class ModelNumRefContracts
  *  @param  int			$hideref        Hide ref
  *  @return int         				0 if KO, 1 if OK
  * @deprecated Use the new function generateDocument of Contrat class
+ * @see Contrat::generateDocument()
  */
 function contract_pdf_create(DoliDB $db, Contrat $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
 }

+ 7 - 7
htdocs/core/modules/dons/html_cerfafr.modules.php

@@ -3,7 +3,7 @@
  * Copyright (C) 2005-2006	Laurent Destailleur		<eldy@users.sourceforge.net>
  * Copyright (C) 2012		Regis Houssin			<regis.houssin@capnetworks.com>
  * Copyright (C) 2012       Marcos García           <marcosgdf@gmail.com>
- * Copyright (C) 2014       Alexandre Spangaro		<alexandre.spangaro@gmail.com>
+ * Copyright (C) 2014-2015  Alexandre Spangaro		<alexandre.spangaro@gmail.com>
  *
  * 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
@@ -181,11 +181,11 @@ class html_cerfafr extends ModeleDon
 				if (preg_match('/fr/i',$outputlangs->defaultlang)) {
 					if ($conf->global->DONATION_ART200 >= 1)
 					{
-						$art200='<input type="checkbox" checked>200 du CGI';
+						$art200='<input type="checkbox" disabled="true" checked>200 du CGI';
 					}
 					else
 					{
-						$art200='<input type="checkbox">200 du CGI';
+						$art200='<input type="checkbox" disabled="true">200 du CGI';
 					}
 				}
 				$form = str_replace('__ARTICLE200__',$art200,$form);
@@ -194,11 +194,11 @@ class html_cerfafr extends ModeleDon
 				if (preg_match('/fr/i',$outputlangs->defaultlang)) {
 					if ($conf->global->DONATION_ART238 >= 1)
 					{
-						$art238='<input type="checkbox" checked>238 bis du CGI';
+						$art238='<input type="checkbox" disabled="true" checked>238 bis du CGI';
 					}
 					else
 					{
-						$art238='<input type="checkbox">238 bis du CGI';
+						$art238='<input type="checkbox" disabled="true">238 bis du CGI';
 					}
 				}
 				$form = str_replace('__ARTICLE238__',$art238,$form);
@@ -207,11 +207,11 @@ class html_cerfafr extends ModeleDon
 				if (preg_match('/fr/i',$outputlangs->defaultlang)) {
 					if ($conf->global->DONATION_ART885 >= 1)
 					{
-						$art885='<input type="checkbox" checked>885-0 V bis du CGI';
+						$art885='<input type="checkbox" disabled="true" checked>885-0 V bis du CGI';
 					}
 					else
 					{
-						$art885='<input type="checkbox">885-0 V bis du CGI';
+						$art885='<input type="checkbox" disabled="true">885-0 V bis du CGI';
 					}
 				}
 				$form = str_replace('__ARTICLE885__',$art885,$form);

+ 3 - 0
htdocs/core/modules/expedition/modules_expedition.php

@@ -154,8 +154,11 @@ abstract class ModelNumRefExpedition
  *  @param      int			$hideref        Hide ref
  * 	@return 	int 						1 if OK -1 if KO
  * 	@deprecated Use the new function generateDocument of Expedition class
+ * @see Expedition::generateDocument()
  */
 function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
 }

+ 3 - 0
htdocs/core/modules/facture/modules_facture.php

@@ -156,9 +156,12 @@ abstract class ModeleNumRefFactures
  *  @param  int			$hideref        Hide ref
  *	@return int        					<0 if KO, >0 if OK
  * @deprecated Use the new function generateDocument of Facture class
+ * @see Facture::generateDocument()
  */
 function facture_pdf_create(DoliDB $db, Facture $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
 }
 

+ 3 - 0
htdocs/core/modules/livraison/modules_livraison.php

@@ -156,9 +156,12 @@ abstract class ModeleNumRefDeliveryOrder
  *	@param	Translate	$outputlangs	objet lang a utiliser pour traduction
  *  @return int         				0 if KO, 1 if OK
  * @deprecated Use the new function generateDocument of Livraison class
+ * @see Livraison::generateDocument()
  */
 function delivery_order_pdf_create(DoliDB $db, Livraison $object, $modele, $outputlangs='')
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs);
 }
 

+ 5 - 0
htdocs/core/modules/mailings/fraise.modules.php

@@ -153,6 +153,11 @@ class mailing_fraise extends MailingTargets
      */
     function add_to_target($mailing_id,$filtersarray=array())
     {
+	    // Deprecation warning
+	    if ($filtersarray) {
+		    dol_syslog(__METHOD__ . ": filtersarray parameter is deprecated", LOG_WARNING);
+	    }
+
     	global $langs,$_POST;
 		$langs->load("members");
         $langs->load("companies");

+ 1 - 2
htdocs/core/modules/modCategorie.class.php

@@ -162,7 +162,7 @@ class modCategorie extends DolibarrModules
         $this->export_enabled[$r]='$conf->adherent->enabled';
 		$this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire"));
 		$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname');
-		$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.rowid'=>'List:adherent:nom','p.lastname'=>'Text','p.firstname'=>'Text');
+		$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text');
 		$this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member');	// We define here only fields that use another picto
 		$this->export_sql_start[$r]='SELECT DISTINCT ';
 		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p';
@@ -213,7 +213,6 @@ class modCategorie extends DolibarrModules
 		$this->export_TypeFields_array[$r] = array (
 			'u.label' => "Text",
 			'u.description' => "Text",
-			'p.rowid' => 'List:contact:lastname',
 			'p.lastname' => 'Text',
 			'p.firstname' => 'Text',
 			's.nom'=>"Text",

+ 3 - 0
htdocs/core/modules/project/modules_project.php

@@ -153,9 +153,12 @@ abstract class ModeleNumRefProjects
  *  @param  int			$hideref        Hide ref
  *  @return int         				0 if KO, 1 if OK
  * @deprecated Use the new function generateDocument of Project class
+ * @see Project::generateDocument()
  */
 function project_pdf_create(DoliDB $db, Project $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
 }
 

+ 3 - 0
htdocs/core/modules/project/task/modules_task.php

@@ -154,9 +154,12 @@ abstract class ModeleNumRefTask
  *  @param  HookManager	$hookmanager	Hook manager instance
  *  @return int         				0 if KO, 1 if OK
  * @deprecated Use the new function generateDocument of Task class
+ * @see Task::generateDocument()
  */
 function task_pdf_create(DoliDB $db, Task $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
 }
 

+ 3 - 0
htdocs/core/modules/propale/modules_propale.php

@@ -157,9 +157,12 @@ abstract class ModeleNumRefPropales
  *  @param      int			$hideref        Hide ref
  * 	@return     int         				0 if KO, 1 if OK
  * @deprecated Use the new function generateDocument of Propal class
+ * @see Propal::generateDocument()
  */
 function propale_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
 }
 

+ 3 - 0
htdocs/core/modules/supplier_order/modules_commandefournisseur.php

@@ -151,9 +151,12 @@ abstract class ModeleNumRefSuppliersOrders
  *  @param      int			$hideref        Hide ref
  *  @return     int          				0 if KO, 1 if OK
  * @deprecated Use the new function generateDocument of CommandeFournisseur class
+ * @see CommandeFournisseur::generateDocument()
  */
 function supplier_order_pdf_create(DoliDB $db, CommandeFournisseur $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
 {
+	dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 	return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
 }
 

+ 2 - 1
htdocs/core/triggers/dolibarrtriggers.class.php

@@ -61,6 +61,7 @@ abstract class DolibarrTriggers
 	 * Error reported by the trigger
 	 * @var string
 	 * @deprecated Use $this->errors
+	 * @see errors
 	 */
 	public $error = '';
 
@@ -145,4 +146,4 @@ abstract class DolibarrTriggers
 	 */
 	abstract function runTrigger($action, $object, User $user, Translate $langs, Conf $conf);
 
-}
+}

+ 5 - 0
htdocs/don/class/don.class.php

@@ -63,6 +63,11 @@ class Don extends CommonObject
 	var $modelpdf;
     var $projet;
 
+	/**
+	 * @deprecated
+	 * @see note_private, note_public
+	 */
+	var $commentaire;
 
     /**
      *  Constructor

+ 7 - 1
htdocs/don/class/paymentdonation.class.php

@@ -49,6 +49,12 @@ class PaymentDonation extends CommonObject
 	var $fk_user_creat;
 	var $fk_user_modif;
 
+	/**
+	 * @deprecated
+	 * @see amount, amounts
+	 */
+	var $total;
+
 	/**
 	 *	Constructor
 	 *
@@ -590,4 +596,4 @@ class PaymentDonation extends CommonObject
 
 		return $result;
 	}
-}
+}

+ 42 - 8
htdocs/expedition/class/expedition.class.php

@@ -77,7 +77,21 @@ class Expedition extends CommonObject
 	var $trueSize;
 
 	var $date_delivery;		// Date delivery planed
-	var $date_expedition;	// Date delivery real
+	/**
+	 * @deprecated
+	 * @see date_shipping
+	 */
+	var $date;
+	/**
+	 * @deprecated
+	 * @see date_shipping
+	 */
+	var $date_expedition;
+	/**
+	 * Effective delivery date
+	 * @var int
+	 */
+	public $date_shipping;
 	var $date_creation;
 	var $date_valid;
 
@@ -459,8 +473,8 @@ class Expedition extends CommonObject
 				$this->statut               = $obj->fk_statut;
 				$this->user_author_id       = $obj->fk_user_author;
 				$this->date_creation        = $this->db->jdate($obj->date_creation);
-				$this->date                 = $this->db->jdate($obj->date_expedition);	// TODO obsolete
-				$this->date_expedition      = $this->db->jdate($obj->date_expedition);	// TODO obsolete
+				$this->date                 = $this->db->jdate($obj->date_expedition);	// TODO deprecated
+				$this->date_expedition      = $this->db->jdate($obj->date_expedition);	// TODO deprecated
 				$this->date_shipping        = $this->db->jdate($obj->date_expedition);	// Date real
 				$this->date_delivery        = $this->db->jdate($obj->date_delivery);	// Date planed
 				$this->fk_delivery_address  = $obj->fk_address;
@@ -783,10 +797,11 @@ class Expedition extends CommonObject
 
 		$orderline = new OrderLine($this->db);
 		$orderline->fetch($id);
-		$fk_product = $orderline->fk_product;
 
-		if (! empty($orderline->fk_product))
+		if (! empty($conf->stock->enabled) && ! empty($orderline->fk_product))
 		{
+			$fk_product = $orderline->fk_product;
+
 			if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS))
 			{
 				$this->error=$langs->trans("ErrorWarehouseRequiredIntoShipmentLine");
@@ -1708,9 +1723,10 @@ class ExpeditionLigne
 
 	// From llx_commandedet or llx_propaldet
 	var $qty_asked;
-	var $libelle;       // Label produit
-	var $product_desc;  // Description produit
-	var $ref;
+	public $product_ref;
+	public $product_label;
+	public $product_desc;
+
 
 	// Invoicing
 	var $remise_percent;
@@ -1720,6 +1736,24 @@ class ExpeditionLigne
 	var $total_localtax1;   // Total Local tax 1
 	var $total_localtax2;   // Total Local tax 2
 
+	public $fk_origin_line;
+
+	// Deprecated
+	/**
+	 * @deprecated
+	 * @see fk_origin_line
+	 */
+	var $origin_line_id;
+	/**
+	 * @deprecated
+	 * @see product_ref
+	 */
+	var $ref;
+	/**
+	 * @deprecated
+	 * @see product_label
+	 */
+	var $libelle;
 
     /**
      *	Constructor

+ 2 - 1
htdocs/expedition/tpl/linkedobjectblock.tpl.php

@@ -41,6 +41,7 @@ print_titre($langs->trans('RelatedShippings'));
 	<td align="right"><?php echo $langs->trans("Status"); ?></td>
 </tr>
 <?php
+$total=0;
 $var=true;
 foreach($linkedObjectBlock as $object)
 {
@@ -71,4 +72,4 @@ foreach($linkedObjectBlock as $object)
 </tr>
 </table>
 
-<!-- END PHP TEMPLATE -->
+<!-- END PHP TEMPLATE -->

+ 11 - 16
htdocs/filefunc.inc.php

@@ -37,22 +37,17 @@ if (! defined('EURO')) define('EURO',chr(128));
 // Define syslog constants
 if (! defined('LOG_DEBUG'))
 {
-    if (function_exists("define_syslog_variables"))
-    {
-    	define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized
-    }
-    else
-    {
-    	// Pour PHP sans syslog (comme sous Windows)
-    	define('LOG_EMERG',0);
-    	define('LOG_ALERT',1);
-    	define('LOG_CRIT',2);
-    	define('LOG_ERR',3);
-    	define('LOG_WARNING',4);
-    	define('LOG_NOTICE',5);
-    	define('LOG_INFO',6);
-    	define('LOG_DEBUG',7);
-    }
+	if (! function_exists("syslog")) {
+		// For PHP versions without syslog (like running on Windows OS)
+		define('LOG_EMERG',0);
+		define('LOG_ALERT',1);
+		define('LOG_CRIT',2);
+		define('LOG_ERR',3);
+		define('LOG_WARNING',4);
+		define('LOG_NOTICE',5);
+		define('LOG_INFO',6);
+		define('LOG_DEBUG',7);
+	}
 }
 
 // End of common declaration part

+ 8 - 1
htdocs/fourn/class/fournisseur.commande.class.php

@@ -55,6 +55,7 @@ class CommandeFournisseur extends CommonOrder
 	/**
 	 * TODO: Remove
 	 * @deprecated
+	 * @see product_ref
 	 */
     var $ref;
     var $product_ref;
@@ -78,8 +79,13 @@ class CommandeFournisseur extends CommonOrder
     var $total_localtax2;   // Total Local tax 2
     var $total_ttc;
     var $source;
+	/**
+	 * @deprecated
+	 * @see note_private, note_public
+	 */
     var $note;
-    var $note_public;
+	public $note_private;
+    public $note_public;
     var $model_pdf;
     var $fk_project;
     var $cond_reglement_id;
@@ -2465,6 +2471,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
 	 * Supplier ref
 	 * @var string
 	 * @deprecated Use ref_supplier
+	 * @see ref_supplier
 	 */
 	public $ref_fourn;
 

+ 24 - 8
htdocs/fourn/class/fournisseur.facture.class.php

@@ -58,12 +58,9 @@ class FactureFournisseur extends CommonInvoice
     var $type = self::TYPE_STANDARD;
 
 	/**
-	 * Check constants for more info:
-	 * - STATUS_DRAFT
-	 * - STATUS_VALIDATED
-	 * - STATUS_PAID
-	 * - STATUS_ABANDONED
+	 * Supplier invoice status
 	 * @var int
+	 * @see FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_PAID, FactureFournisseur::STATUS_ABANDONED
 	 */
     var $statut;
     //! 1 si facture payee COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant)
@@ -85,7 +82,11 @@ class FactureFournisseur extends CommonInvoice
     var $total_localtax1;
     var $total_localtax2;
     var $total_ttc;
-    var $note;			// deprecated
+	/**
+	 * @deprecated
+	 * @see note_private, note_public
+	 */
+    var $note;
     var $note_private;
     var $note_public;
     var $propalid;
@@ -100,7 +101,10 @@ class FactureFournisseur extends CommonInvoice
 	 * @var SupplierInvoiceLine[]
 	 */
     public $lines = array();
-    var $fournisseur;	// deprecated
+	/**
+	 * @deprecated
+	 */
+    var $fournisseur;
 
 	//Incorterms
 	var $fk_incoterms;
@@ -1896,9 +1900,17 @@ class SupplierInvoiceLine extends CommonObjectLine
 
 	var $oldline;
 
+	/**
+	 * @deprecated
+	 * @see product_ref
+	 */
 	public $ref;
 	public $product_ref;
 	public $ref_supplier;
+	/**
+	 * @deprecated
+	 * @see label
+	 */
 	public $libelle;
 	public $product_desc;
 
@@ -1906,8 +1918,10 @@ class SupplierInvoiceLine extends CommonObjectLine
 	 * Unit price before taxes
 	 * @var float
 	 * @deprecated Use $subprice
+	 * @see subprice
 	 */
 	public $pu_ht;
+	public $subprice;
 
 	/**
 	 * Unit price included taxes
@@ -1919,8 +1933,10 @@ class SupplierInvoiceLine extends CommonObjectLine
 	 * Total VAT amount
 	 * @var float
 	 * @deprecated Use $total_tva instead
+	 * @see total_tva
 	 */
 	public $tva;
+	public $total_tva;
 
 	/**
 	 * Id of the corresponding supplier invoice
@@ -1932,7 +1948,7 @@ class SupplierInvoiceLine extends CommonObjectLine
 	 * Product label
 	 * @var string
 	 */
-	var $label;				// deprecated
+	var $label;
 
 	/**
 	 * Description of the line

+ 8 - 2
htdocs/fourn/class/fournisseur.product.class.php

@@ -42,7 +42,11 @@ class ProductFournisseur extends Product
     var $product_fourn_price_id;  // id of ligne product-supplier
 
     var $id;                      // product id
-    var $fourn_ref;               // deprecated
+	/**
+	 * @deprecated
+	 * @see ref_supplier
+	 */
+    var $fourn_ref;
     var $delivery_time_days;
     var $ref_supplier;			  // ref supplier (can be set by get_buyprice)
     var $vatrate_supplier;		  // default vat rate for this supplier/qty/product (can be set by get_buyprice)
@@ -161,6 +165,7 @@ class ProductFournisseur extends Product
     function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0)
     {
         global $conf, $langs;
+        //global $mysoc;
 
         // Clean parameter
         if (empty($qty)) $qty=0;
@@ -348,7 +353,8 @@ class ProductFournisseur extends Product
             if ($obj)
             {
             	$this->product_fourn_price_id	= $rowid;
-            	$this->fourn_ref				= $obj->ref_fourn;
+            	$this->fourn_ref				= $obj->ref_fourn; // deprecated
+	            $this->ref_supplier             = $obj->ref_fourn;
             	$this->fourn_price				= $obj->price;
             	$this->fourn_charges            = $obj->charges;
             	$this->fourn_qty                = $obj->quantity;

+ 2 - 1
htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php

@@ -39,6 +39,7 @@ print_titre($langs->trans('RelatedSupplierOrders'));
 	<td align="right"><?php echo $langs->trans("Status"); ?></td>
 </tr>
 <?php
+$total=0;
 $var=true;
 foreach($linkedObjectBlock as $object)
 {
@@ -68,4 +69,4 @@ foreach($linkedObjectBlock as $object)
 </tr>
 </table>
 
-<!-- END PHP TEMPLATE -->
+<!-- END PHP TEMPLATE -->

+ 10 - 1
htdocs/fourn/facture/card.php

@@ -1508,7 +1508,16 @@ if ($action == 'create')
 	        $langs->load('orders');
 	        $txt=$langs->trans("SupplierOrder");
         }
-        print '<tr><td>'.$txt.'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
+        print '<tr><td>'.$txt.'</td><td colspan="2">'.$objectsrc->getNomUrl(1);
+        //We check if Origin document has already an invoice attached to it
+        $objectsrc->fetchObjectLinked($originid,'','','invoice_supplier');
+        $cntinvoice=count($objectsrc->linkedObjects['invoice_supplier']);
+        if ($cntinvoice>=1)
+        {
+        	setEventMessage('WarningBillExist','warnings');
+        	echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')';
+        }
+        echo '</td></tr>';
         print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
         print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
         if ($mysoc->country_code=='ES')

+ 2 - 1
htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php

@@ -40,6 +40,7 @@ print_titre($langs->trans("RelatedSupplierInvoices"));
 	<td align="right"><?php echo $langs->trans("Status"); ?></td>
 </tr>
 <?php
+$total=0;
 $var=true;
 foreach($linkedObjectBlock as $object)
 {
@@ -68,4 +69,4 @@ foreach($linkedObjectBlock as $object)
 </tr>
 </table>
 
-<!-- END PHP TEMPLATE -->
+<!-- END PHP TEMPLATE -->

+ 4 - 0
htdocs/holiday/class/holiday.class.php

@@ -38,6 +38,10 @@ class Holiday extends CommonObject
     var $error;
     var $errors=array();
 
+	/**
+	 * @deprecated
+	 * @see id
+	 */
     var $rowid;
     var $ref;
 

+ 33 - 32
htdocs/install/mysql/migration/3.6.0-3.7.0.sql

@@ -98,36 +98,36 @@ ALTER TABLE llx_accountingaccount add column fk_user_author integer DEFAULT NULL
 ALTER TABLE llx_accountingaccount add column fk_user_modif integer DEFAULT NULL AFTER fk_user_author;
 
 -- Qual
-UPDATE llx_const SET name = 'ACCOUNTING_MODE' WHERE name = 'COMPTA_MODE';
-UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_CUSTOMER' WHERE name = 'COMPTA_ACCOUNT_CUSTOMER';
-UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_SUPPLIER' WHERE name = 'COMPTA_ACCOUNT_SUPPLIER';
-UPDATE llx_const SET name = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT' WHERE name = 'COMPTA_PRODUCT_BUY_ACCOUNT';
-UPDATE llx_const SET name = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT' WHERE name = 'COMPTA_PRODUCT_SOLD_ACCOUNT';
-UPDATE llx_const SET name = 'ACCOUNTING_SERVICE_BUY_ACCOUNT' WHERE name = 'COMPTA_SERVICE_BUY_ACCOUNT';
-UPDATE llx_const SET name = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT' WHERE name = 'COMPTA_SERVICE_SOLD_ACCOUNT';
-UPDATE llx_const SET name = 'ACCOUNTING_VAT_ACCOUNT' WHERE name = 'COMPTA_VAT_ACCOUNT';
-UPDATE llx_const SET name = 'ACCOUNTING_VAT_BUY_ACCOUNT' WHERE name = 'COMPTA_VAT_BUY_ACCOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_MODE')__ WHERE __DECRYPT('name')__ = 'COMPTA_MODE';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_CUSTOMER')__ WHERE __DECRYPT('name')__ = 'COMPTA_ACCOUNT_CUSTOMER';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_SUPPLIER')__ WHERE __DECRYPT('name')__ = 'COMPTA_ACCOUNT_SUPPLIER';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_PRODUCT_BUY_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_PRODUCT_BUY_ACCOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_PRODUCT_SOLD_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_PRODUCT_SOLD_ACCOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SERVICE_BUY_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_SERVICE_BUY_ACCOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SERVICE_SOLD_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_SERVICE_SOLD_ACCOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_VAT_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_VAT_ACCOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_VAT_BUY_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'COMPTA_VAT_BUY_ACCOUNT';
 
 -- Compatibility with module Accounting Expert
-UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_MODELCSV' WHERE name = 'ACCOUNTINGEX_MODELCSV';
-UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_SEPARATORCSV' WHERE name = 'ACCOUNTINGEX_SEPARATORCSV';
-UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_DATE' WHERE name = 'ACCOUNTINGEX_EXP_DATE';
-UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_PIECE' WHERE name = 'ACCOUNTINGEX_EXP_PIECE';
-UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT' WHERE name = 'ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT';
-UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_LABEL' WHERE name = 'ACCOUNTINGEX_EXP_LABEL';
-UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_AMOUNT' WHERE name = 'ACCOUNTINGEX_EXP_AMOUNT';
-UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_DEVISE' WHERE name = 'ACCOUNTINGEX_EXP_DEVISE';
-UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_SUSPENSE' WHERE name = 'ACCOUNTINGEX_ACCOUNT_SUSPENSE';
-UPDATE llx_const SET name = 'ACCOUNTING_SELL_JOURNAL' WHERE name = 'ACCOUNTINGEX_SELL_JOURNAL';
-UPDATE llx_const SET name = 'ACCOUNTING_PURCHASE_JOURNAL' WHERE name = 'ACCOUNTINGEX_PURCHASE_JOURNAL';
-UPDATE llx_const SET name = 'ACCOUNTING_SOCIAL_JOURNAL' WHERE name = 'ACCOUNTINGEX_SOCIAL_JOURNAL';
-UPDATE llx_const SET name = 'ACCOUNTING_MISCELLANEOUS_JOURNAL' WHERE name = 'ACCOUNTINGEX_MISCELLANEOUS_JOURNAL';
-UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH' WHERE name = 'ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH';
-UPDATE llx_const SET name = 'ACCOUNTING_LENGTH_GACCOUNT' WHERE name = 'ACCOUNTINGEX_LENGTH_GACCOUNT';
-UPDATE llx_const SET name = 'ACCOUNTING_LENGTH_AACCOUNT' WHERE name = 'ACCOUNTINGEX_LENGTH_AACCOUNT';
-UPDATE llx_const SET name = 'ACCOUNTING_LIMIT_LIST_VENTILATION' WHERE name = 'ACCOUNTINGEX_LIMIT_LIST_VENTILATION';
-UPDATE llx_const SET name = 'ACCOUNTING_LIST_SORT_VENTILATION_TODO' WHERE name = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO';
-UPDATE llx_const SET name = 'ACCOUNTING_LIST_SORT_VENTILATION_DONE' WHERE name = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_MODELCSV')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_MODELCSV';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_SEPARATORCSV')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_SEPARATORCSV';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_DATE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_DATE';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_PIECE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_PIECE';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_GLOBAL_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_LABEL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_LABEL';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_AMOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_AMOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_DEVISE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_EXP_DEVISE';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_SUSPENSE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_ACCOUNT_SUSPENSE';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SELL_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_SELL_JOURNAL';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_PURCHASE_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_PURCHASE_JOURNAL';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_SOCIAL_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_SOCIAL_JOURNAL';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_MISCELLANEOUS_JOURNAL')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_MISCELLANEOUS_JOURNAL';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_ACCOUNT_TRANSFER_CASH')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LENGTH_GACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LENGTH_GACCOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LENGTH_AACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LENGTH_AACCOUNT';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LIMIT_LIST_VENTILATION')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LIMIT_LIST_VENTILATION';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LIST_SORT_VENTILATION_TODO')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO';
+UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_LIST_SORT_VENTILATION_DONE')__ WHERE __DECRYPT('name')__ = 'ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE';
 
 -- Drop old table
 DROP TABLE llx_compta;
@@ -1133,9 +1133,9 @@ ALTER TABLE llx_c_email_templates ADD UNIQUE INDEX uk_c_email_templates(entity,
 ALTER TABLE llx_c_email_templates ADD INDEX idx_type(type_template);
 
 -- Remove OSC module
-DELETE FROM llx_const WHERE name = 'MAIN_MODULE_BOUTIQUE';
-DELETE FROM llx_const WHERE name = 'OSC_DB_HOST';
-DELETE FROM llx_menu WHERE module = 'boutique';
+DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'MAIN_MODULE_BOUTIQUE';
+DELETE FROM llx_const WHERE __DECRYPT('name')__ = 'OSC_DB_HOST';
+DELETE FROM llx_menu WHERE __DECRYPT('module')__ = 'boutique';
 
 -- Add option always editable on extrafield
 ALTER TABLE llx_extrafields ADD alwayseditable INTEGER DEFAULT 0 AFTER pos;
@@ -1181,4 +1181,5 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_typ
 
 ALTER TABLE llx_livraison MODIFY COLUMN date_delivery DATETIME NULL DEFAULT NULL;
 
-INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT 'PRODUCT_USE_OLD_PATH_FOR_PHOTO','1','chaine','Use old path for products images',0,1 FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL' AND value < '3.7.0';
+-- This constant is for compatibility if user come from 3.6 or lower. Must not be enabled on 3.7.0 or +
+INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT __ENCRYPT('PRODUCT_USE_OLD_PATH_FOR_PHOTO')__,__ENCRYPT('1')__,'chaine','Use old path for products images',1,0 FROM llx_const WHERE __DECRYPT('name')__ = 'MAIN_VERSION_LAST_INSTALL' AND __DECRYPT('value')__ < '3.7.0'; 

+ 6 - 4
htdocs/install/upgrade2.php

@@ -3824,8 +3824,9 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
 	    if ($moduletoreload == 'MAIN_MODULE_SERVICE')    // Permission has changed into 2.7
 	    {
 	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Service");
+	        
+	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php';
 	        if ($res) {
-	            $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php';
 	            $mod=new modService($db);
 	            //$mod->remove('noboxes');
 	            $mod->init('newboxdefonly');
@@ -3834,8 +3835,9 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
 	    if ($moduletoreload == 'MAIN_MODULE_COMMANDE')   // Permission has changed into 2.9
 	    {
 	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Commande");
+	        
+	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php';
 	        if ($res) {
-	            $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php';
 	            $mod=new modCommande($db);
 	            //$mod->remove('noboxes');
 	            $mod->init('newboxdefonly');
@@ -3844,8 +3846,8 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
 	    if ($moduletoreload == 'MAIN_MODULE_FACTURE')    // Permission has changed into 2.9
 	    {
 	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Facture");
+	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php';
 	        if ($res) {
-	            $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php';
 	            $mod=new modFacture($db);
 	            //$mod->remove('noboxes');
 	            $mod->init('newboxdefonly');
@@ -3884,8 +3886,8 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array())
 	    if ($moduletoreload == 'MAIN_MODULE_ECM')    // Permission has changed into 3.0 and 3.1
 	    {
 	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ECM");
+	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php';
 	        if ($res) {
-	            $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php';
 	            $mod=new modECM($db);
 	            $mod->remove('noboxes');	// We need to remove because a permission id has been removed
 	            $mod->init('newboxdefonly');

+ 4 - 3
htdocs/langs/en_US/admin.lang

@@ -231,8 +231,8 @@ Security=Security
 Passwords=Passwords
 DoNotStoreClearPassword=Do no store clear passwords in database but store only encrypted value (Activated recommended)
 MainDbPasswordFileConfEncrypted=Database password encrypted in conf.php (Activated recommended)
-InstrucToEncodePass=To have password encoded into the <b>conf.php</b> file, replace the line <br><b>$dolibarr_main_db_pass="..."</b><br>by<br><b>$dolibarr_main_db_pass="crypted:%s"</b>
-InstrucToClearPass=To have password decoded (clear) into the <b>conf.php</b> file, replace the line <br><b>$dolibarr_main_db_pass="crypted:..."</b><br>by<br><b>$dolibarr_main_db_pass="%s"</b>
+InstrucToEncodePass=To have password encoded into the <b>conf.php</b> file, replace the line <br><b>$dolibarr_main_db_pass="...";</b><br>by<br><b>$dolibarr_main_db_pass="crypted:%s";</b>
+InstrucToClearPass=To have password decoded (clear) into the <b>conf.php</b> file, replace the line <br><b>$dolibarr_main_db_pass="crypted:...";</b><br>by<br><b>$dolibarr_main_db_pass="%s";</b>
 ProtectAndEncryptPdfFiles=Protection of generated pdf files (Activated NOT recommended, breaks mass pdf generation)
 ProtectAndEncryptPdfFilesDesc=Protection of a PDF document keeps it available to read and print with any PDF browser. However, editing and copying is not possible anymore. Note that using this feature make building of a global cumulated pdf not working (like unpaid invoices).
 Feature=Feature
@@ -939,6 +939,7 @@ CompanyZip=Zip
 CompanyTown=Town
 CompanyCountry=Country
 CompanyCurrency=Main currency
+CompanyObject=Object of the company
 Logo=Logo
 DoNotShow=Do not show
 DoNotSuggestPaymentMode=Do not suggest
@@ -1638,4 +1639,4 @@ InstallModuleFromWebHasBeenDisabledByFile=Install of external module from applic
 ConfFileMuseContainCustom=Installing an external module from application save the module files into directory <strong>%s</strong>. To have this directory processed by Dolibarr, you must setup your <strong>conf/conf.php</strong> to have option<br>- <strong>$dolibarr_main_url_root_alt</strong> enabled to value <strong>$dolibarr_main_url_root_alt="/custom"</strong><br>- <strong>$dolibarr_main_document_root_alt</strong> enabled to value <strong>"%s/custom"</strong> 
 HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over
 PressF5AfterChangingThis=Press F5 on keyboard after changing this value to have it effective
-NotSupportedByAllThemes=Will works with eldy theme but is not supported by all themes
+NotSupportedByAllThemes=Will works with eldy theme but is not supported by all themes

+ 4 - 4
htdocs/langs/en_US/companies.lang

@@ -410,10 +410,10 @@ OutstandingBillReached=Reached max. for outstanding bill
 MonkeyNumRefModelDesc=Return numero with format %syymm-nnnn for customer code and %syymm-nnnn for supplier code where yy is year, mm is month and nnnn is a sequence with no break and no return to 0.
 LeopardNumRefModelDesc=The code is free. This code can be modified at any time.
 ManagingDirectors=Manager(s) name (CEO, director, president...)
-SearchThirdparty=Search thirdparty
+SearchThirdparty=Search third party
 SearchContact=Search contact
-MergeOriginThirdparty=Origin thirdparty
-MergeThirdparties=Merge thirdparties
-ConfirmMergeThirdparties=Are you sure you want to merge this thirdparty? All linked objects (invoices...) will be linked with the destination thirdparty
+MergeOriginThirdparty=Duplicate third party (third party you want to delete)
+MergeThirdparties=Merge third parties
+ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one ? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one.
 ThirdpartiesMergeSuccess=Thirdparties have been merged
 ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted.

+ 18 - 3
htdocs/livraison/class/livraison.class.php

@@ -52,6 +52,11 @@ class Livraison extends CommonObject
 	var $ref_customer;
 	var $statut;
 
+	/**
+	 * @deprecated
+	 * @see note_public, note_private
+	 */
+	var $note;
 	var $note_public;
 	var $note_private;
 
@@ -1014,10 +1019,8 @@ class Livraison extends CommonObject
 /**
  *  Classe de gestion des lignes de bons de livraison
  */
-class LivraisonLigne
+class LivraisonLigne extends CommonObjectLine
 {
-	var $db;
-
 	// From llx_expeditiondet
 	var $qty;
 	var $qty_asked;
@@ -1027,7 +1030,19 @@ class LivraisonLigne
 	var $origin_id;
 	var $label;       // Label produit
 	var $description;  // Description produit
+	/**
+	 * @deprecated
+	 * @see product_ref
+	 */
 	var $ref;
+	/**
+	 * @deprecated
+	 * @see product_label;
+	 */
+	var $libelle;
+
+	public $product_ref;
+	public $product_label;
 
 	/**
 	 *	Constructor

+ 6 - 0
htdocs/loan/class/paymentloan.class.php

@@ -52,6 +52,12 @@ class PaymentLoan extends CommonObject
 	var $fk_user_creat;
 	var $fk_user_modif;
 
+	/**
+	 * @deprecated
+	 * @see amount, amounts
+	 */
+	var $total;
+
 	/**
 	 *	Constructor
 	 *

+ 5 - 0
htdocs/opensurvey/class/opensurveysondage.class.php

@@ -43,7 +43,12 @@ class Opensurveysondage extends CommonObject
     var $id;
 
 	var $id_sondage;
+	/**
+	 * @deprecated
+	 * @see description
+	 */
 	var $commentaires;
+	public $description;
 
 	var $mail_admin;
 	var $nom_admin;

+ 32 - 8
htdocs/product/class/product.class.php

@@ -59,10 +59,15 @@ class Product extends CommonObject
 	var $id ;
 	//! Ref
 	var $ref;
-    /**
-     * Product label
-     * @var string
-     */
+	/*
+	 * @deprecated
+	 * @see label
+	 */
+	var $libelle;
+	/**
+	 * Product label
+	 * @var string
+	 */
 	var $label;
     /**
      * Product descripion
@@ -183,6 +188,20 @@ class Product extends CommonObject
 
     var $fk_price_expression;
 
+	/**
+	 * @deprecated
+	 * @see fourn_pu
+	 */
+	var $buyprice;
+	public $fourn_pu;
+
+	/**
+	 * @deprecated
+	 * @see ref_supplier
+	 */
+	var $ref_fourn;
+	public $ref_supplier;
+
 	/**
 	 * Unit code ('km', 'm', 'l', 'p', ...)
 	 * @var string
@@ -817,6 +836,11 @@ class Product extends CommonObject
 	 */
 	function delete($id=0)
 	{
+		// Deprecation warning
+		if (0 == $id) {
+			dol_syslog(__METHOD__ . " with parameter is deprecated", LOG_WARNING);
+		}
+
 		global $conf,$user,$langs;
 		require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
 
@@ -1252,7 +1276,7 @@ class Product extends CommonObject
                     	$obj->price = $price_result;
                     }
                 }
-				$this->buyprice = $obj->price;                      // \deprecated
+				$this->buyprice = $obj->price;                      // deprecated
 				$this->fourn_pu = $obj->price / $obj->quantity;     // Prix unitaire du produit pour le fournisseur $fourn_id
 				$this->ref_fourn = $obj->ref_fourn;                 // Ref supplier
 				$this->vatrate_supplier = $obj->tva_tx;             // Vat ref supplier
@@ -3915,9 +3939,9 @@ class Product extends CommonObject
 	/**
 	 * Function used to replace a thirdparty id with another one.
 	 *
-	 * @param DoliDB $db Database handler
-	 * @param int $origin_id Old thirdparty id
-	 * @param int $dest_id New thirdparty id
+	 * @param DoliDB 	$db 			Database handler
+	 * @param int 		$origin_id 		Old thirdparty id
+	 * @param int 		$dest_id 		New thirdparty id
 	 * @return bool
 	 */
 	public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)

+ 18 - 18
htdocs/projet/card.php

@@ -311,7 +311,7 @@ if (empty($reshook))
 	    $result = $object->setValid($user);
 	    if ($result <= 0)
 	    {
-		    setEventMessage($object->error, 'errors');
+	        setEventMessages($object->error, $object->errors, 'errors');
 	    }
 	}
 
@@ -320,7 +320,7 @@ if (empty($reshook))
 	    $result = $object->setClose($user);
 	    if ($result <= 0)
 	    {
-		    setEventMessage($object->error, 'errors');
+	        setEventMessages($object->error, $object->errors, 'errors');
 	    }
 	}
 
@@ -329,7 +329,7 @@ if (empty($reshook))
 	    $result = $object->setValid($user);
 	    if ($result <= 0)
 	    {
-		    setEventMessage($object->error, 'errors');
+	        setEventMessages($object->error, $object->errors, 'errors');
 	    }
 	}
 
@@ -339,14 +339,14 @@ if (empty($reshook))
 	    $result=$object->delete($user);
 	    if ($result > 0)
 	    {
-	        header("Location: index.php");
+	        setEventMessage($langs->trans("RecordDeleted"), 'info');
+	    	header("Location: index.php");
 	        exit;
 	    }
 	    else
 	    {
 	        dol_syslog($object->error,LOG_DEBUG);
-	        setEventMessage($object->error,'errors');
-	        setEventMessage($object->errors,'errors');
+	        setEventMessages($object->error, $object->errors, 'errors');
 	    }
 	}
 
@@ -737,11 +737,11 @@ else
         {
             if ($userWrite > 0)
             {
-                print '<a class="butAction" href="card.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
+                print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a></div>';
             }
             else
             {
-                print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Modify').'</a>';
+                print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Modify').'</a></div>';
             }
         }
 
@@ -750,11 +750,11 @@ else
         {
             if ($userWrite > 0)
             {
-                print '<a class="butAction" href="card.php?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a>';
+                print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a></div>';
             }
             else
             {
-                print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Validate').'</a>';
+                print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Validate').'</a></div>';
             }
         }
 
@@ -763,11 +763,11 @@ else
         {
             if ($userWrite > 0)
             {
-                print '<a class="butAction" href="card.php?id='.$object->id.'&amp;action=close">'.$langs->trans("Close").'</a>';
+                print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=close">'.$langs->trans("Close").'</a></div>';
             }
             else
             {
-                print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Close').'</a>';
+                print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Close').'</a></div>';
             }
         }
 
@@ -776,11 +776,11 @@ else
         {
             if ($userWrite > 0)
             {
-                print '<a class="butAction" href="card.php?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a>';
+                print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=reopen">'.$langs->trans("ReOpen").'</a></div>';
             }
             else
             {
-                print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ReOpen').'</a>';
+                print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ReOpen').'</a></div>';
             }
         }
 
@@ -789,11 +789,11 @@ else
         {
             if ($userWrite > 0)
             {
-                print '<a class="butAction" href="card.php?id='.$object->id.'&action=clone">'.$langs->trans('ToClone').'</a>';
+                print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=clone">'.$langs->trans('ToClone').'</a></div>';
             }
             else
             {
-                print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ToClone').'</a>';
+                print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('ToClone').'</a></div>';
             }
         }
 
@@ -802,11 +802,11 @@ else
         {
             if ($userDelete > 0)
             {
-                print '<a class="butActionDelete" href="card.php?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
+                print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a></div>';
             }
             else
             {
-                print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Delete').'</a>';
+                print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Delete').'</a></div>';
             }
         }
     }

+ 28 - 1
htdocs/projet/class/project.class.php

@@ -46,6 +46,12 @@ class Project extends CommonObject
     var $id;
     var $ref;
     var $description;
+	/**
+	 * @var string
+	 * @deprecated
+	 * @see title
+	 */
+	public $titre;
     var $title;
     var $date_start;
     var $date_end;
@@ -66,6 +72,27 @@ class Project extends CommonObject
     var $weekWorkLoad;			// Used to store workload details of a projet
     var $weekWorkLoadPerTask;	// Used to store workload details of tasks of a projet
 
+	/**
+	 * @var int Creation date
+	 * @deprecated
+	 * @see date_c
+	 */
+	public $datec;
+	/**
+	 * @var int Creation date
+	 */
+	public $date_c;
+	/**
+	 * @var int Modification date
+	 * @deprecated
+	 * @see date_m
+	 */
+	public $datem;
+	/**
+	 * @var int Modification date
+	 */
+	public $date_m;
+
 
     /**
      *  Constructor
@@ -515,7 +542,7 @@ class Project extends CommonObject
         // Set fk_projet into elements to null
         $listoftables=array(
         		'facture'=>'fk_projet','propal'=>'fk_projet','commande'=>'fk_projet','facture_fourn'=>'fk_projet','commande_fournisseur'=>'fk_projet',
-        		'expensereport_det'=>'fk_projet','contrat'=>'fk_projet','fichinter'=>'fk_projet','don'=>'fk_project'
+        		'expensereport_det'=>'fk_projet','contrat'=>'fk_projet','fichinter'=>'fk_projet','don'=>'fk_projet'
         		);
         foreach($listoftables as $key => $value)
         {

+ 3 - 2
htdocs/projet/tasks/task.php

@@ -37,7 +37,7 @@ $langs->load("projects");
 $langs->load("companies");
 
 $id=GETPOST('id','int');
-$ref=GETPOST('ref','alpha');
+$ref=GETPOST("ref",'alpha',1);
 $action=GETPOST('action','alpha');
 $confirm=GETPOST('confirm','alpha');
 $withproject=GETPOST('withproject','int');
@@ -81,6 +81,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
 		$task_parent=$tmparray[1];
 		if (empty($task_parent)) $task_parent = 0;	// If task_parent is ''
 
+		$object->ref = GETPOST("ref",'alpha',2);
 		$object->label = $_POST["label"];
 		$object->description = $_POST['description'];
 		$object->fk_task_parent = $task_parent;
@@ -308,7 +309,7 @@ if ($id > 0 || ! empty($ref))
 
 			// Ref
 			print '<tr><td width="30%">'.$langs->trans("Ref").'</td>';
-			print '<td>'.$object->ref.'</td></tr>';
+			print '<td><input size="12" name="ref" value="'.$object->ref.'"></td></tr>';
 
 			// Label
 			print '<tr><td>'.$langs->trans("Label").'</td>';

+ 7 - 7
htdocs/public/api/index.php

@@ -28,7 +28,7 @@
 if (! defined("NOLOGIN"))        define("NOLOGIN",'1');
 
 $res=0;
-if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php';					
+if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php';
 if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../dolibarr/htdocs/main.inc.php';     // For custom directory
 if (! $res) die("Include of main fails");
 
@@ -47,7 +47,7 @@ if (empty($conf->global->MAIN_MODULE_API))
     exit;
 }
 
-use Luracast\Restler\Defaults;
+use \Luracast\Restler\Defaults;
 Defaults::setProperty('authenticationMethod','_isAllowed');
 
 $api = new DolibarrApi($db);
@@ -64,7 +64,7 @@ foreach ($modulesdir as $dir)
      * Search available module
      */
     dol_syslog("Scan directory ".$dir." for API modules");
-    
+
     $handle=@opendir(dol_osencode($dir));
     if (is_resource($handle))
     {
@@ -81,7 +81,7 @@ foreach ($modulesdir as $dir)
                 if ($module == 'societe') {
 					$obj = 'thirdparty';
 				}
-                if ($module == 'categorie') { 
+                if ($module == 'categorie') {
                     $part = 'categories';
 					$obj = 'category';
 				}
@@ -90,7 +90,7 @@ foreach ($modulesdir as $dir)
 					$obj = 'facture';
 				}
                 if (empty($conf->$module->enabled)) $enabled=false;
-                
+
                 if ($enabled)
                 {
                     /*
@@ -102,7 +102,7 @@ foreach ($modulesdir as $dir)
                      * @todo : use getElementProperties() function ?
                      */
                     $dir_part = DOL_DOCUMENT_ROOT.'/'.$part.'/class/';
-                        
+
                     $handle_part=@opendir(dol_osencode($dir_part));
                     if (is_resource($handle_part))
                     {
@@ -125,4 +125,4 @@ foreach ($modulesdir as $dir)
     }
 }
 
-$api->r->handle(); //serve the response
+$api->r->handle(); //serve the response

+ 2 - 2
htdocs/public/test/test_forms.php

@@ -17,8 +17,8 @@ llxHeader();
 <h1>
 This page is a sample of page using Dolibarr HTML widget methods. It is designed to make test with<br>
 - css (add parameter &theme=newtheme to test another theme or edit css of current theme)<br>
-- jmobile (add parameter dol_use_jmobile=1&dol_optimize_smallscreen=1 to enable view with jmobile)<br>
-- no javascript / usage for bind people (add parameter nojs=1 to force disable javascript)<br>
+- jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=1&dol_optimize_smallscreen=1</a> to enable view with jmobile)<br>
+- no javascript / usage for bind people (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
 </h1>
 <br>
 

+ 2 - 2
htdocs/resource/class/resource.class.php

@@ -606,9 +606,9 @@ class Resource extends CommonObject
      * Fetch all resources available, declared by modules
      * Load available resource in array $this->available_resources
      *
-     * note : deprecated, remplaced by hook getElementResources
-     *
      * @return int 	number of available resources declared by modules
+     * @deprecated, remplaced by hook getElementResources
+     * @see getElementResources()
      */
     function fetch_all_available() {
     	global $conf;

+ 2 - 0
htdocs/societe/canvas/actions_card_common.class.php

@@ -52,6 +52,8 @@ abstract class ActionsCardCommon
 	 */
 	private function getInstanceDao()
 	{
+		dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
+
 		if (! is_object($this->object))
 		{
 			$modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php');

+ 1 - 1
htdocs/societe/class/client.class.php

@@ -108,7 +108,7 @@ class Client extends Societe
 		while ($i < $num)
 		{
 			$obj=$this->db->fetch_object($resql);
-			$this->cacheprospectstatus[$obj->id]=array('id'=>$obj->id, 'code'=>$obj->code, 'label'=> $langs->trans("aaa")?$obj->label:'');
+			$this->cacheprospectstatus[$obj->id]=array('id'=>$obj->id, 'code'=>$obj->code, 'label'=> ($langs->trans("ST_".strtoupper($obj->code))=="ST_".strtoupper($obj->code))?$obj->label:$langs->trans("ST_".strtoupper($obj->code)));
 			$i++;
 		}
 		return 1;

+ 6 - 1
htdocs/societe/class/societe.class.php

@@ -59,6 +59,7 @@ class Societe extends CommonObject
      * Thirdparty name
      * @var string
      * @deprecated Use $name instead
+     * @see name
      */
     public $nom;
 
@@ -88,18 +89,21 @@ class Societe extends CommonObject
      * State code
      * @var string
      * @deprecated Use state_code instead
+     * @see state_code
      */
     var $departement_code;
 
     /**
      * @var string
      * @deprecated Use state instead
+     * @see state
      */
     var $departement;
 
     /**
      * @var string
      * @deprecated Use country instead
+     * @see country
      */
     var $pays;
     var $country_id;
@@ -298,6 +302,7 @@ class Societe extends CommonObject
     /**
      * @var string
      * @deprecated Note is split in public and private notes
+     * @see note_public, note_private
      */
     var $note;
 
@@ -2804,7 +2809,7 @@ class Societe extends CommonObject
         if (empty($name)) $name=$member->getFullName($langs);
 
         // Positionne parametres
-        $this->nom=$name;				// TODO obsolete
+        $this->nom=$name;				// TODO deprecated
         $this->name=$name;
         $this->address=$member->address;
         $this->zip=$member->zip;

+ 120 - 108
htdocs/societe/soc.php

@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2003      Brian Fraval         <brian@fraval.org>
- * Copyright (C) 2004-2014 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005      Eric Seigne          <eric.seigne@ryxeo.com>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2008      Patrick Raguin       <patrick.raguin@auguria.net>
@@ -98,22 +98,29 @@ if (empty($reshook))
 {
 	if ($action == 'confirm_merge' && $confirm == 'yes')
 	{
+		$object->fetch($socid);
+
 		$errors = 0;
 		$soc_origin_id = GETPOST('soc_origin', 'int');
 		$soc_origin = new Societe($db);
 
-		if ($soc_origin_id < 1) {
+		if ($soc_origin_id < 1)
+		{
 			$langs->load('errors');
 			$langs->load('companies');
 			setEventMessage($langs->trans('ErrorProdIdIsMandatory', $langs->trans('MergeOriginThirdparty')), 'errors');
-		} else {
+		}
+		else
+		{
 
-			if (!$errors && $soc_origin->fetch($soc_origin_id) < 1) {
+			if (!$errors && $soc_origin->fetch($soc_origin_id) < 1)
+			{
 				setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
 				$errors++;
 			}
 
-			if (!$errors) {
+			if (!$errors)
+			{
 				$db->begin();
 
 				$objects = array(
@@ -141,13 +148,13 @@ if (empty($reshook))
 				);
 
 				//First, all core objects must update their tables
-				foreach ($objects as $object_name => $object_file) {
-
+				foreach ($objects as $object_name => $object_file)
+				{
 					require_once DOL_DOCUMENT_ROOT.$object_file;
 
-					if (!$errors && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) {
+					if (!$errors && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id))
+					{
 						$errors++;
-						$db->rollback();
 					}
 				}
 
@@ -156,32 +163,37 @@ if (empty($reshook))
 					'mergethirds'
 				));
 
-				if (!$errors) {
+				if (!$errors)
+				{
 					$reshook = $hookmanager->executeHooks('replaceThirdparty', array(
 						'soc_origin' => $soc_origin->id,
 						'soc_dest' => $object->id
 					), $soc_dest, $action);
 
-					if ($reshook < 0) {
+					if ($reshook < 0)
+					{
 						setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
 						$errors++;
 					}
 				}
 
-				if (!$errors) {
+				if (!$errors)
+				{
 					//We finally remove the old thirdparty
-					if ($soc_origin->delete($soc_origin->id, $user) < 1) {
-						$db->rollback();
+					if ($soc_origin->delete($soc_origin->id, $user) < 1)
+					{
 						$errors++;
 					}
 				}
-			}
 
-			if (!$errors) {
-				setEventMessage($langs->trans('ThirdpartiesMergeSuccess'));
-				$db->commit();
-			} else {
-				setEventMessage($langs->trans('ErrorsThirdpartyMerge'), 'errors');
+				if (!$errors)
+				{
+					setEventMessage($langs->trans('ThirdpartiesMergeSuccess'));
+					$db->commit();
+				} else {
+					setEventMessage($langs->trans('ErrorsThirdpartyMerge'), 'errors');
+					$db->rollback();
+				}
 			}
 		}
 	}
@@ -230,15 +242,15 @@ if (empty($reshook))
         {
             $object->particulier       = GETPOST("private");
 
-            $object->name              = dolGetFirstLastname(GETPOST('firstname','alpha'),GETPOST('nom','alpha')?GETPOST('nom','alpha'):GETPOST('name','alpha'));
+            $object->name              = dolGetFirstLastname(GETPOST('firstname','alpha'),GETPOST('name','alpha'));
             $object->civility_id       = GETPOST('civility_id', 'int');
             // Add non official properties
-            $object->name_bis          = GETPOST('name','alpha')?GETPOST('name','alpha'):GETPOST('nom','alpha');
+            $object->name_bis          = GETPOST('name','alpha');
             $object->firstname         = GETPOST('firstname','alpha');
         }
         else
         {
-            $object->name              = GETPOST('name', 'alpha')?GETPOST('name', 'alpha'):GETPOST('nom', 'alpha');
+            $object->name              = GETPOST('name', 'alpha');
         }
         $object->address               = GETPOST('address', 'alpha');
         $object->zip                   = GETPOST('zipcode', 'alpha');
@@ -796,7 +808,7 @@ else
         if (GETPOST("type")=='p')  { $object->client=2; }
         if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || (GETPOST("type")=='' && empty($conf->global->THIRDPARTY_NOTSUPPLIER_BY_DEFAULT))))  { $object->fournisseur=1; }
 
-        $object->name				= GETPOST('nom', 'alpha');
+        $object->name				= GETPOST('name', 'alpha');
         $object->firstname			= GETPOST('firstname', 'alpha');
         $object->particulier		= $private;
         $object->prefix_comm		= GETPOST('prefix_comm');
@@ -963,14 +975,14 @@ else
 	    print '<tr><td>';
         if ($object->particulier || $private)
         {
-	        print '<span id="TypeName" class="fieldrequired"><label for="name">'.$langs->trans('LastName').'</label></span>';
+	        print '<span id="TypeName" class="fieldrequired">'.$langs->trans('LastName','name').'</span>';
         }
         else
 		{
-			print '<span span id="TypeName" class="fieldrequired"><label for="name">'.$langs->trans('ThirdPartyName').'</label></span>';
+			print '<span span id="TypeName" class="fieldrequired">'.fieldLabel('ThirdPartyName','name').'</span>';
         }
 	    print '</td><td'.(empty($conf->global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>';
-	    print '<input type="text" size="60" maxlength="128" name="nom" id="name" value="'.$object->name.'" autofocus="autofocus"></td>';
+	    print '<input type="text" size="60" maxlength="128" name="name" id="name" value="'.$object->name.'" autofocus="autofocus"></td>';
 	    if (! empty($conf->global->SOCIETE_USEPREFIX))  // Old not used prefix field
 	    {
 		    print '<td>'.$langs->trans('Prefix').'</td><td><input type="text" size="5" maxlength="5" name="prefix_comm" value="'.$object->prefix_comm.'"></td>';
@@ -980,16 +992,16 @@ else
         // If javascript on, we show option individual
         if ($conf->use_javascript_ajax)
         {
-            print '<tr class="individualline"><td><label for="firstname">'.$langs->trans('FirstName').'</label></td>';
+            print '<tr class="individualline"><td>'.fieldLabel('FirstName','firstname').'</td>';
 	        print '<td><input type="text" size="60" name="firstname" id="firstname" value="'.$object->firstname.'"></td>';
             print '<td colspan=2>&nbsp;</td></tr>';
-            print '<tr class="individualline"><td><label for="civility_id">'.$langs->trans("UserTitle").'</label></td><td>';
+            print '<tr class="individualline"><td>'.fieldLabel('UserTitle','cibility_id').'</td><td>';
             print $formcompany->select_civility($object->civility_id).'</td>';
             print '<td colspan=2>&nbsp;</td></tr>';
         }
 
         // Prospect/Customer
-        print '<tr><td width="25%"><span class="fieldrequired"><label for="customerprospect">'.$langs->trans('ProspectCustomer').'</label></span></td>';
+        print '<tr><td width="25%">'.fieldLabel('ProspectCustomer','customerprospect',1).'</td>';
 	    print '<td width="25%" class="maxwidthonsmartphone"><select class="flat" name="client" id="customerprospect">';
         $selected=isset($_POST['client'])?GETPOST('client'):$object->client;
         if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="2"'.($selected==2?' selected':'').'>'.$langs->trans('Prospect').'</option>';
@@ -998,7 +1010,7 @@ else
         print '<option value="0"'.($selected==0?' selected':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
         print '</select></td>';
 
-        print '<td width="25%"><label for="customer_code">'.$langs->trans('CustomerCode').'</label></td><td width="25%">';
+        print '<td width="25%">'.fieldLabel('CustomerCode','customer_code').'</td><td width="25%">';
         print '<table class="nobordernopadding"><tr><td>';
         $tmpcode=$object->code_client;
         if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0);
@@ -1013,10 +1025,10 @@ else
         {
             // Supplier
             print '<tr>';
-            print '<td><span class="fieldrequired"><label for="fournisseur">'.$langs->trans('Supplier').'</label></span></td><td>';
+            print '<td>'.fieldLabel('Supplier','fournisseur',1).'</td><td>';
             print $form->selectyesno("fournisseur",(isset($_POST['fournisseur'])?GETPOST('fournisseur'):$object->fournisseur),1);
             print '</td>';
-            print '<td><label for="supplier_code">'.$langs->trans('SupplierCode').'</label></td><td>';
+            print '<td>'.fieldLabel('SupplierCode','supplier_code').'</td><td>';
             print '<table class="nobordernopadding"><tr><td>';
             $tmpcode=$object->code_fournisseur;
             if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1);
@@ -1029,33 +1041,33 @@ else
         }
 
         // Status
-        print '<tr><td><label for="status">'.$langs->trans('Status').'</label></td><td colspan="3">';
+        print '<tr><td>'.fieldLabel('Status','status').'</td><td colspan="3">';
         print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),1);
         print '</td></tr>';
 
         // Barcode
         if (! empty($conf->barcode->enabled))
         {
-            print '<tr><td><label for="barcode">'.$langs->trans('Gencod').'</label></td>';
+            print '<tr><td>'.fieldLabel('Gencod','barcode').'</td>';
 	        print '<td colspan="3"><input type="text" name="barcode" id="barcode" value="'.$object->barcode.'">';
             print '</td></tr>';
         }
 
         // Address
-        print '<tr><td class="tdtop"><label for="address">'.$langs->trans('Address').'</label></td>';
+        print '<tr><td class="tdtop">'.fieldLabel('Address','address').'</td>';
 	    print '<td colspan="3"><textarea name="address" id="address" cols="80" rows="'._ROWS_2.'" wrap="soft">';
         print $object->address;
         print '</textarea></td></tr>';
 
         // Zip / Town
-        print '<tr><td><label for="zipcode">'.$langs->trans('Zip').'</label></td><td>';
+        print '<tr><td>'.fieldLabel('Zip','zipcode').'</td><td>';
         print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
-        print '</td><td><label for="town">'.$langs->trans('Town').'</label></td><td>';
+        print '</td><td>'.fieldLabel('Town','town').'</td><td>';
         print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'));
         print '</td></tr>';
 
         // Country
-        print '<tr><td width="25%"><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
+        print '<tr><td width="25%">'.fieldLabel('Country','selectcountry_id').'</td><td colspan="3" class="maxwidthonsmartphone">';
         print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id));
         if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
         print '</td></tr>';
@@ -1063,29 +1075,29 @@ else
         // State
         if (empty($conf->global->SOCIETE_DISABLE_STATE))
         {
-            print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
+            print '<tr><td>'.fieldLabel('State','state_id').'</td><td colspan="3" class="maxwidthonsmartphone">';
             if ($object->country_id) print $formcompany->select_state($object->state_id,$object->country_code);
             else print $countrynotdefined;
             print '</td></tr>';
         }
 
         // Email web
-        print '<tr><td><label for="email">'.$langs->trans('EMail').(! empty($conf->global->SOCIETE_MAIL_REQUIRED)?'*':'').'</label></td>';
+        print '<tr><td>'.fieldLabel('EMail','email').(! empty($conf->global->SOCIETE_MAIL_REQUIRED)?'*':'').'</td>';
 	    print '<td colspan="3"><input type="text" name="email" id="email" size="32" value="'.$object->email.'"></td></tr>';
-        print '<tr><td><label for="url">'.$langs->trans('Web').'</label></td>';
+        print '<tr><td>'.fieldLabel('Web','url').'</td>';
 	    print '<td colspan="3"><input type="text" name="url" id="url" size="32" value="'.$object->url.'"></td></tr>';
 
         // Skype
         if (! empty($conf->skype->enabled))
         {
-            print '<tr><td><label for="skype">'.$langs->trans('Skype').'</label></td>';
+            print '<tr><td>'.fieldLabel('Skype','skype').'</td>';
 	        print '<td colspan="3"><input type="text" name="skype" id="skype" size="32" value="'.$object->skype.'"></td></tr>';
         }
 
         // Phone / Fax
-        print '<tr><td><label for="phone">'.$langs->trans('Phone').'</label></td>';
+        print '<tr><td>'.fieldLabel('Phone','phone').'</td>';
 	    print '<td><input type="text" name="phone" id="phone" value="'.$object->phone.'"></td>';
-        print '<td><label for="fax">'.$langs->trans('Fax').'</label></td>';
+        print '<td>'.fieldLabel('Fax','fax').'</td>';
 	    print '<td><input type="text" name="fax" id="fax" value="'.$object->fax.'"></td></tr>';
 
         // Prof ids
@@ -1101,9 +1113,9 @@ else
 
                 $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY';
                	if(empty($conf->global->$idprof_mandatory))
-                	print '<td><label for="'.$key.'">'.$idprof.'</label></td><td>';
+                	print '<td>'.fieldLabel($idprof,$key).'</td><td>';
                 else
-                    print '<td><span class="fieldrequired"><label for="'.$key.'">'.$idprof.'</label></td><td>';
+                    print '<td>'.fieldLabel($idprof,$key,1).'</td><td>';
 
                 print $formcompany->get_input_id_prof($i,$key,$object->$key,$object->country_code);
                 print '</td>';
@@ -1115,11 +1127,11 @@ else
         if ($j % 2 == 1) print '<td colspan="2"></td></tr>';
 
         // Assujeti TVA
-        print '<tr><td><label for="assujtva_value">'.$langs->trans('VATIsUsed').'</label></td>';
+        print '<tr><td>'.fieldLabel('VATIsUsed','assujtva_value').'</td>';
         print '<td>';
         print $form->selectyesno('assujtva_value',1,1);     // Assujeti par defaut en creation
         print '</td>';
-        print '<td class="nowrap"><label for="intra_vat">'.$langs->trans('VATIntra').'</label></td>';
+        print '<td class="nowrap">'.fieldLabel('VATIntra','inra_vat').'</td>';
         print '<td class="nowrap">';
         $s = '<input type="text" class="flat" name="tva_intra" id="intra_vat" size="12" maxlength="20" value="'.$object->tva_intra.'">';
 
@@ -1149,17 +1161,17 @@ else
         print '</tr>';
 
         // Type - Size
-        print '<tr><td><label for="typent_id">'.$langs->trans("ThirdPartyType").'</label></td><td>'."\n";
+        print '<tr><td>'.fieldLabel('ThirdPartyType','typent_id').'</td><td>'."\n";
         print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
         if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
         print '</td>';
-        print '<td><label for="effectif_id">'.$langs->trans("Staff").'</label></td><td>';
+        print '<td>'.fieldLabel('Staff','effectif_id').'</td><td>';
         print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id);
         if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
         print '</td></tr>';
 
         // Legal Form
-        print '<tr><td><label for="legal_form">'.$langs->trans('JuridicalStatus').'</label></td>';
+        print '<tr><td>'.fieldLabel('JuridicalStatus','legal_form').'</td>';
         print '<td colspan="3" class="maxwidthonsmartphone">';
         if ($object->country_id)
         {
@@ -1172,7 +1184,7 @@ else
         print '</td></tr>';
 
         // Capital
-        print '<tr><td><label for="capital">'.$langs->trans('Capital').'</label></td>';
+        print '<tr><td>'.fieldLabel('Capital','capital').'</td>';
 	    print '<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="'.$object->capital.'"> ';
         print '<span class="hideonsmartphone">'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
 
@@ -1202,7 +1214,7 @@ else
 
         if (! empty($conf->global->MAIN_MULTILANGS))
         {
-            print '<tr><td><label for="default_lang">'.$langs->trans("DefaultLang").'</label></td><td colspan="3" class="maxwidthonsmartphone">'."\n";
+            print '<tr><td>'.fieldLabel('DefaultLang','default_lang').'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
             print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1);
             print '</td>';
             print '</tr>';
@@ -1212,7 +1224,7 @@ else
         {
             // Assign a Name
             print '<tr>';
-            print '<td><label for="commercial_id">'.$langs->trans("AllocateCommercial").'</label></td>';
+            print '<td>'.fieldLabel('AllocateCommercial','commercial_id').'</td>';
             print '<td colspan="3" class="maxwidthonsmartphone">';
             $form->select_users((! empty($object->commercial_id)?$object->commercial_id:$user->id),'commercial_id',1); // Add current user by default
             print '</td></tr>';
@@ -1222,7 +1234,7 @@ else
 		if (!empty($conf->incoterm->enabled))
 		{
 			print '<tr>';
-			print '<td><label for="incoterm_id">'.$langs->trans("IncotermLabel").'</label></td>';
+			print '<td>'.fieldLabel('IncotermLabel','incoterm_id').'</td>';
 	        print '<td colspan="3" class="maxwidthonsmartphone">';
 	        print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''));
 			print '</td></tr>';
@@ -1231,12 +1243,12 @@ else
 		// Categories
 	    if (! empty($conf->categorie->enabled)  && ! empty($user->rights->categorie->lire))
 	    {
-			print '<tr><td class="toptd">'.$langs->trans("Categories").'</td><td colspan="3">';
+			print '<tr><td class="toptd">'.fieldLabel('Categories','custcats').'</td><td colspan="3">';
 			$cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1);
 			print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%");
 			print "</td></tr>";
 	    }
-	    
+
         // Other attributes
         $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
         $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
@@ -1247,7 +1259,7 @@ else
 
         // Ajout du logo
         print '<tr class="hideonsmartphone">';
-        print '<td><label for="photoinput">'.$langs->trans("Logo").'</label></td>';
+        print '<td>'.fieldLabel('Logo','photoinput').'</td>';
         print '<td colspan="3">';
         print '<input class="flat" type="file" name="photo" id="photoinput" />';
         print '</td>';
@@ -1319,10 +1331,10 @@ else
 
             $object->oldcopy=dol_clone($object);
 
-            if (GETPOST('nom'))
+            if (GETPOST('name'))
             {
                 // We overwrite with values if posted
-                $object->name					= GETPOST('nom', 'alpha');
+                $object->name					= GETPOST('name', 'alpha');
                 $object->prefix_comm			= GETPOST('prefix_comm', 'alpha');
                 $object->client					= GETPOST('client', 'int');
                 $object->code_client			= GETPOST('code_client', 'alpha');
@@ -1452,13 +1464,13 @@ else
             print '<table class="border" width="100%">';
 
             // Name
-            print '<tr><td><label for="name"><span class="fieldrequired">'.$langs->trans('ThirdPartyName').'</span></label></td>';
-	        print '<td colspan="3"><input type="text" size="60" maxlength="128" name="nom" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus"></td></tr>';
+            print '<tr><td>'.fieldLabel('ThirdPartyName','name',1).'</td>';
+	        print '<td colspan="3"><input type="text" size="60" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus"></td></tr>';
 
             // Prefix
             if (! empty($conf->global->SOCIETE_USEPREFIX))  // Old not used prefix field
             {
-                print '<tr><td><label for="prefix">'.$langs->trans("Prefix").'</label></td><td colspan="3">';
+                print '<tr><td>'.fieldLabel('Prefix','prefix').'</td><td colspan="3">';
                 // It does not change the prefix mode using the auto numbering prefix
                 if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm)
                 {
@@ -1473,14 +1485,14 @@ else
             }
 
             // Prospect/Customer
-            print '<tr><td width="25%"><span class="fieldrequired"><label for="customerprospect">'.$langs->trans('ProspectCustomer').'</label></span></td>';
+            print '<tr><td width="25%">'.fieldLabel('ProspectCustomer','customerprospect',1).'</td>';
 	        print '<td width="25%"><select class="flat" name="client" id="customerprospect">';
             if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print '<option value="2"'.($object->client==2?' selected':'').'>'.$langs->trans('Prospect').'</option>';
             if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print '<option value="3"'.($object->client==3?' selected':'').'>'.$langs->trans('ProspectCustomer').'</option>';
             if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print '<option value="1"'.($object->client==1?' selected':'').'>'.$langs->trans('Customer').'</option>';
             print '<option value="0"'.($object->client==0?' selected':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
             print '</select></td>';
-            print '<td width="25%"><label for="customer_code">'.$langs->trans('CustomerCode').'</label></td><td width="25%">';
+            print '<td width="25%">'.fieldLabel('CustomerCode','customer_code').'</td><td width="25%">';
 
             print '<table class="nobordernopadding"><tr><td>';
             if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto)
@@ -1510,10 +1522,10 @@ else
             if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))
             {
                 print '<tr>';
-                print '<td><span class="fieldrequired"><label for="fournisseur">'.$langs->trans('Supplier').'</label></span></td><td>';
+                print '<td>'.fieldLabel('Supplier','fournisseur',1).'</td><td>';
                 print $form->selectyesno("fournisseur",$object->fournisseur,1);
                 print '</td>';
-                print '<td><label for="supplier_code">'.$langs->trans('SupplierCode').'</label></td><td>';
+                print '<td>'.fieldLabel('SupplierCode','supplier_code').'</td><td>';
 
                 print '<table class="nobordernopadding"><tr><td>';
                 if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto)
@@ -1543,31 +1555,31 @@ else
             // Barcode
             if (! empty($conf->barcode->enabled))
             {
-                print '<tr><td class="tdtop"><label for="barcode">'.$langs->trans('Gencod').'</label></td>';
+                print '<tr><td class="tdtop">'.fieldLabel('Gencod','barcode').'</td>';
 	            print '<td colspan="3"><input type="text" name="barcode" id="barcode" value="'.$object->barcode.'">';
                 print '</td></tr>';
             }
 
             // Status
-            print '<tr><td><label for="status">'.$langs->trans("Status").'</label></td><td colspan="3">';
+            print '<tr><td>'.fieldLabel('Status','status').'</td><td colspan="3">';
             print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$object->status);
             print '</td></tr>';
 
             // Address
-            print '<tr><td class="tdtop"><label for="address">'.$langs->trans('Address').'</label></td>';
+            print '<tr><td class="tdtop">'.fieldLabel('Address','address').'</td>';
 	        print '<td colspan="3"><textarea name="address" id="address" cols="80" rows="3" wrap="soft">';
             print $object->address;
             print '</textarea></td></tr>';
 
             // Zip / Town
-            print '<tr><td><label for="zipcode">'.$langs->trans('Zip').'</label></td><td>';
+            print '<tr><td>'.fieldLabel('Zip','zipcode').'</td><td>';
             print $formcompany->select_ziptown($object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
-            print '</td><td><label for="town">'.$langs->trans('Town').'</label></td><td>';
+            print '</td><td>'.fieldLabel('Town','town').'</td><td>';
             print $formcompany->select_ziptown($object->town,'town',array('zipcode','selectcountry_id','state_id'));
             print '</td></tr>';
 
             // Country
-            print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td colspan="3">';
+            print '<tr><td>'.fieldLabel('Country','selectcounty_id').'</td><td colspan="3">';
             print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id),'country_id');
             if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
             print '</td></tr>';
@@ -1575,28 +1587,28 @@ else
             // State
             if (empty($conf->global->SOCIETE_DISABLE_STATE))
             {
-                print '<tr><td><label for="state_id">'.$langs->trans('State').'</label></td><td colspan="3">';
+                print '<tr><td>'.fieldLabel('State','state_id').'</td><td colspan="3">';
                 print $formcompany->select_state($object->state_id,$object->country_code);
                 print '</td></tr>';
             }
 
             // EMail / Web
-            print '<tr><td><label for="email">'.$langs->trans('EMail').(! empty($conf->global->SOCIETE_MAIL_REQUIRED)?'*':'').'</label></td>';
+            print '<tr><td>'.fieldLabel('EMail','email',(! empty($conf->global->SOCIETE_MAIL_REQUIRED))).'</td>';
 	        print '<td colspan="3"><input type="text" name="email" id="email" size="32" value="'.$object->email.'"></td></tr>';
-            print '<tr><td><label for="url">'.$langs->trans('Web').'</label></td>';
+            print '<tr><td>'.fieldLabel('Web','url').'</td>';
 	        print '<td colspan="3"><input type="text" name="url" id="url" size="32" value="'.$object->url.'"></td></tr>';
 
             // Skype
             if (! empty($conf->skype->enabled))
             {
-                print '<tr><td><label for="skype">'.$langs->trans('Skype').'</label></td>';
+                print '<tr><td>'.fieldLabel('Skype','skype').'</td>';
 	            print '<td colspan="3"><input type="text" name="skype" id="skype" size="32" value="'.$object->skype.'"></td></tr>';
             }
 
             // Phone / Fax
-            print '<tr><td><label for="phone">'.$langs->trans('Phone').'</label></td>';
+            print '<tr><td>'.fieldLabel('Phone','phone').'</td>';
 	        print '<td><input type="text" name="phone" id="phone" value="'.$object->phone.'"></td>';
-            print '<td><label for="fax">'.$langs->trans('Fax').'</label></td>';
+            print '<td>'.fieldLabel('Fax','fax').'</td>';
 	        print '<td><input type="text" name="fax" id="fax" value="'.$object->fax.'"></td></tr>';
 
             // Prof ids
@@ -1612,9 +1624,9 @@ else
 
 	                $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY';
 	                if(empty($conf->global->$idprof_mandatory))
-	                    print '<td><label for="'.$key.'">'.$idprof.'</label></td><td>';
+	                    print '<td>'.fieldLabel($idprof,$key).'</td><td>';
                     else
-	                    print '<td><span class="fieldrequired"><label for="'.$key.'">'.$idprof.'</label></td><td>';
+	                    print '<td><span class="fieldrequired">'.fieldLabel($idprof,$key).'</td><td>';
 
 	                print $formcompany->get_input_id_prof($i,$key,$object->$key,$object->country_code);
                     print '</td>';
@@ -1626,12 +1638,12 @@ else
             if ($j % 2 == 1) print '<td colspan="2"></td></tr>';
 
             // VAT payers
-            print '<tr><td><label for="assjtva_value">'.$langs->trans('VATIsUsed').'</label></td><td>';
+            print '<tr><td>'.fieldLabel('VATIsUsed','assujtva_value').'</td><td>';
             print $form->selectyesno('assujtva_value',$object->tva_assuj,1);
             print '</td>';
 
             // VAT Code
-            print '<td><label for="intra_vat">'.$langs->trans('VATIntra').'</label></td>';
+            print '<td>'.fieldLabel('VATIntra','intra_vat').'</td>';
             print '<td>';
             $s ='<input type="text" class="flat" name="tva_intra" id="intra_vat" size="12" maxlength="20" value="'.$object->tva_intra.'">';
 
@@ -1664,7 +1676,7 @@ else
             //TODO: Place into a function to control showing by country or study better option
         	if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
             {
-                print '<tr><td><label for="localtax1assuj_value">'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</label></td><td>';
+                print '<tr><td>'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').'</td><td>';
                 print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1);
                 if(! isOnlyOneLocalTax(1))
                 {
@@ -1673,7 +1685,7 @@ else
                 	print '</span>';
                 }
 
-                print '</td><td><label for="localtax2assuj_value">'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</label></td><td>';
+                print '</td><td>'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').'</td><td>';
                 print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
 	            if  (! isOnlyOneLocalTax(2))
 	            {
@@ -1686,7 +1698,7 @@ else
             }
             elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1")
             {
-                print '<tr><td><label for="localtax1assuj_value">'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</label></td><td colspan="3">';
+                print '<tr><td>'.fieldLabel($langs->transcountry("LocalTax1IsUsed",$mysoc->country_code),'localtax1assuj_value').'</td><td colspan="3">';
                 print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1);
                 if(! isOnlyOneLocalTax(1))
                 {
@@ -1699,7 +1711,7 @@ else
             }
             elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1")
             {
-                print '<tr><td><label for="localtax2assuj_value">'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</label></td><td colspan="3">';
+                print '<tr><td>'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').'</td><td colspan="3">';
                 print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
                 if(! isOnlyOneLocalTax(2))
                 {
@@ -1711,28 +1723,28 @@ else
             }
 
             // Type - Size
-            print '<tr><td><label for="typent_id">'.$langs->trans("ThirdPartyType").'</label></td><td>';
+            print '<tr><td>'.fieldLabel('ThirdPartyType','typent_id').'</td><td>';
             print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
             if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
             print '</td>';
-            print '<td><label for="effectif_id">'.$langs->trans("Staff").'</label></td><td>';
+            print '<td>'.fieldLabel('Staff','effectif_id').'</td><td>';
             print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $object->effectif_id);
             if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
             print '</td></tr>';
 
             // Juridical type
-            print '<tr><td><label for="legal_form">'.$langs->trans('JuridicalStatus').'</label></td><td colspan="3">';
+            print '<tr><td>'.fieldLabel('JuridicalStatus','legal_form').'</td><td colspan="3">';
             print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'legal_form');
             print '</td></tr>';
 
             // Capital
-            print '<tr><td><label for="capital">'.$langs->trans("Capital").'</label></td>';
+            print '<tr><td>'.fieldLabel('Capital','capital').'</td>';
 	        print '<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="'.$object->capital.'"><font class="hideonsmartphone">'.$langs->trans("Currency".$conf->currency).'</font></td></tr>';
 
             // Default language
             if (! empty($conf->global->MAIN_MULTILANGS))
             {
-                print '<tr><td><label for="default_lang">'.$langs->trans("DefaultLang").'</label></td><td colspan="3">'."\n";
+                print '<tr><td>'.fieldLabel('DefaultLang','default_lang').'</td><td colspan="3">'."\n";
                 print $formadmin->select_language($object->default_lang,'default_lang',0,0,1);
                 print '</td>';
                 print '</tr>';
@@ -1741,7 +1753,7 @@ else
 			// Categories
 		    if (! empty($conf->categorie->enabled)  && ! empty($user->rights->categorie->lire))
 		    {
-	            print '<tr><td><label for="custcats">' . $langs->trans("Categories") . '</label></td>';
+	            print '<tr><td>'.fieldLabel('Categories', 'custcats').'</td>';
 		        print '<td colspan="3">';
 				$cate_arbo = $form->select_all_categories( Categorie::TYPE_CUSTOMER, null, null, null, null, 1);
 				$c = new Categorie( $db );
@@ -1752,7 +1764,7 @@ else
 				print $form->multiselectarray( 'custcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%');
 				print "</td></tr>";
 		    }
-		    
+
             // Other attributes
             $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
             $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
@@ -1763,9 +1775,9 @@ else
 
             // Webservices url/key
             if (!empty($conf->syncsupplierwebservices->enabled)) {
-                print '<tr><td><label for="webservices_url">'.$langs->trans('WebServiceURL').'</label></td>';
+                print '<tr><td>'.fieldLabel('WebServiceURL','webservices_url').'</td>';
                 print '<td><input type="text" name="webservices_url" id="webservices_url" size="32" value="'.$object->webservices_url.'"></td>';
-                print '<td><label for="webservices_key">'.$langs->trans('WebServiceKey').'</label></td>';
+                print '<td>'.fieldLabel('WebServiceKey','webservices_key').'</td>';
                 print '<td><input type="text" name="webservices_key" id="webservices_key" size="32" value="'.$object->webservices_key.'"></td></tr>';
             }
 
@@ -1773,7 +1785,7 @@ else
 			if (!empty($conf->incoterm->enabled))
 			{
 				print '<tr>';
-				print '<td><label for="incoterm_id">'.$langs->trans("IncotermLabel").'</label></td>';
+				print '<td>'.fieldLabel('IncotermLabel','incoterm_id').'</td>';
 	            print '<td colspan="3" class="maxwidthonsmartphone">';
 	            print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''));
 				print '</td></tr>';
@@ -1781,7 +1793,7 @@ else
 
             // Logo
             print '<tr class="hideonsmartphone">';
-            print '<td><label for="photoinput">'.$langs->trans("Logo").'</label></td>';
+            print '<td>'.fieldLabel('Logo','photoinput').'</td>';
             print '<td colspan="3">';
             if ($object->logo) print $form->showphoto('societe',$object);
             $caneditfield=1;
@@ -1827,21 +1839,21 @@ else
         // Confirm delete third party
         if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)))
         {
-            print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"action-delete");
+            print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "action-delete");
         }
 
-	    if ($action == 'merge') {
-		    $form = new Form($db);
-
-		    $options = array(
+	    if ($action == 'merge')
+	    {
+		    $formquestion = array(
 			    array(
-				    'label' => $langs->trans('MergeOriginThirdparty'),
+				    'name' => 'soc_origin',
+			    	'label' => $langs->trans('MergeOriginThirdparty'),
 				    'type' => 'other',
-				    'value' => $form->select_company('', 'soc_origin', 's.rowid != '.$object->id, 1)
+				    'value' => $form->select_thirdparty('', 'soc_origin', 's.rowid != '.$object->id)
 			    )
 		    );
 
-		    print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id,$langs->trans("MergeThirdparties"),$langs->trans("ConfirmMergeThirdparties"),"confirm_merge",$options,'',1);
+		    print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1);
 	    }
 
         dol_htmloutput_errors($error,$errors);
@@ -2187,7 +2199,7 @@ else
 			print $form->showCategories( $object->id, 'customer', 1 );
 			print "</td></tr>";
 	    }
-	    
+
 		// Incoterms
 		if (!empty($conf->incoterm->enabled))
 		{

BIN
htdocs/theme/common/logo_cerfa.png


BIN
htdocs/theme/eldy/img/info_black.png


+ 44 - 4
htdocs/theme/eldy/style.css.php

@@ -1400,7 +1400,12 @@ div.tabs {
 	clear:both;
 	height:100%;
 }
-div.tabsElem { margin-top: 1px; }		/* To avoid overlap of tabs when not browser */
+div.tabsElem {
+	margin-top: 1px;
+	<?php if (! empty($conf->dol_use_jmobile)) { ?>;
+	margin-bottom: -1px;
+	<?php } ?>
+}		/* To avoid overlap of tabs when not browser */
 
 div.tabBar {
     color: #<?php echo $colortextbacktab; ?>;
@@ -1828,7 +1833,7 @@ div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border
 div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col {
 	vertical-align: middle;
 }
-div.tabBar .tdtop {
+div .tdtop {
     vertical-align: top;
 	padding-top: 5px;
 	padding-bottom: 0px;
@@ -1969,6 +1974,13 @@ table.liste td {
 
 
 /* Pagination */
+div.refid  {
+	padding-top: <?php print empty($conf->dol_use_jmobile)?'8':'12'; ?>px;
+  	font-weight: bold;
+  	color: #766;
+  	font-size: 120%;
+}
+
 div.pagination {
 	float: right;
 }
@@ -1987,8 +1999,10 @@ div.pagination li {
   display: inline-block;
   padding-left: 0px;
   padding-right: 0px;
+<?php if (empty($conf->dol_use_jmobile)) { ?>
   padding-top: 6px;
-  padding-bottom: 6px;
+  padding-bottom: 5px;
+<?php } ?>
 }
 .pagination {
   display: inline-block;
@@ -1997,7 +2011,9 @@ div.pagination li {
 }
 div.pagination li.pagination a,
 div.pagination li.pagination span {
+<?php if (empty($conf->dol_use_jmobile)) { ?>
   padding: 6px 12px;
+<?php } ?>
   margin-left: -1px;
   line-height: 1.42857143;
   color: #000;
@@ -2006,10 +2022,26 @@ div.pagination li.pagination span {
 div.pagination li.pagination span.inactive {
   cursor: default;
 }
+div.pagination li.litext a {
+border: none;
+  padding-right: 10px;
+  padding-left: 4px;
+  font-weight: bold;
+}
+<?php if (! empty($conf->dol_use_jmobile)) { ?>
+div.pagination li.litext {
+  padding-top: 13px;
+  vertical-align: top;
+}
+<?php } ?>
 <?php if (empty($conf->dol_use_jmobile)) { ?>
+div.pagination li.noborder a:hover {
+  border: none;
+  background-color: transparent;
+}
 div.pagination li a,
 div.pagination li span {
-	background-color: #fff;
+  background-color: #fff;
   border: 1px solid #ddd;
 }
 div.pagination li:first-child a,
@@ -3471,6 +3503,14 @@ ul.ulmenu {
 	color: #<?php echo $colorshadowtitle; ?> !important;
 	text-shadow: none !important;
 }
+/*
+.ui-btn-up-c {
+	background: transparent;
+}
+*/
+div.tabsElem a.tab {
+	background: transparent;
+}
 .ui-controlgroup-horizontal .ui-btn.ui-first-child {
 -webkit-border-top-left-radius: 6px;
 border-top-left-radius: 6px;

+ 10 - 2
htdocs/user/class/user.class.php

@@ -74,8 +74,16 @@ class User extends CommonObject
 	var $datem;
 
 	//! If this is defined, it is an external user
-	var $societe_id;	// deprecated
-	var $contact_id;	// deprecated
+	/**
+	 * @deprecated
+	 * @see socid
+	 */
+	var $societe_id;
+	/**
+	 * @deprecated
+	 * @see contactid
+	 */
+	var $contact_id;
 	var $socid;
 	var $contactid;
 

+ 5 - 1
htdocs/user/class/usergroup.class.php

@@ -40,8 +40,12 @@ class UserGroup extends CommonObject
 
 	var $id;			// Group id
 	var $entity;		// Entity of group
+	/**
+	 * @deprecated
+	 * @see name
+	 */
 	var $nom;			// Name of group
-	var $name;			// Name of group	// deprecated
+	var $name;			// Name of group
 	var $globalgroup;	// Global group
 	var $note;			// Note on group
 	var $datec;			// Creation date of group

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików