Browse Source

Merge remote-tracking branch 'origin/3.7' into develop

Conflicts:
	htdocs/contact/exportimport.php
	htdocs/contact/info.php
	htdocs/core/class/commonobject.class.php
	htdocs/core/class/html.form.class.php
	htdocs/core/modules/DolibarrModules.class.php
	htdocs/core/modules/modSociete.class.php
	htdocs/core/tpl/document_actions_pre_headers.tpl.php
	htdocs/langs/fr_FR/categories.lang
	htdocs/main.inc.php
	htdocs/product/reassort.php
	htdocs/projet/list.php
	htdocs/societe/info.php
Laurent Destailleur 10 years ago
parent
commit
2f2b0df6f8

+ 6 - 0
ChangeLog

@@ -229,6 +229,7 @@ Dolibarr better:
 FIX [ bug #2855 ] Wrong translation key in localtax report page
 FIX [ bug #1852 ] JS error when editing a customer order line
 FIX [ bug #2900 ] Courtesy title is not stored in create thirdparty form
+FIX [ bug #3055 ] Product image thumbnails were not deleted after deleting the image
 
 ***** ChangeLog for 3.7.1 compared to 3.7.* *****
 FIX Bug in the new photo system
@@ -485,6 +486,7 @@ Dolibarr better:
 - Fix: [ bug #2542 ] Contracts store localtax preferences
 - Fix: Bad permission assignments for stock movements actions
 - Fix: [ bug #2891 ] Category hooks do not work
+- Fix: [ bug #2696 ] Adding complementary attribute fails if code is numerics
 
 ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
 - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
@@ -664,6 +666,10 @@ Fix: [ bug #2861 ] Undefined variable $res when migrating
 Fix: [ bug #2837 ] Product list table column header does not match column body
 Fix: [ bug #2835 ] Customer prices of a product shows incorrect history order
 Fix: [ bug #2814 ] JPEG photos are not displayed in Product photos page
+Fix: [ bug #2715 ] Statistics page has broken layout with long thirdparty names
+Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid
+Fix: [ bug #3268 ] SQL error when accessing thirdparty log page without a socid parameter
+Fix: [ bug #3180 ] formObjectOptions hook when editing thirdparty card does not print result
 
 ***** ChangeLog for 3.5.6 compared to 3.5.5 *****
 Fix: Avoid missing class error for fetch_thirdparty method #1973

+ 1 - 1
htdocs/compta/bank/class/account.class.php

@@ -1263,7 +1263,7 @@ class AccountLine extends CommonObject
         if ($this->rappro)
         {
             // Protection to avoid any delete of consolidated lines
-            $this->error="DeleteNotPossibleLineIsConsolidated";
+            $this->error="ErrorDeleteNotPossibleLineIsConsolidated";
             return -1;
         }
 

+ 8 - 1
htdocs/compta/facture/stats/index.php

@@ -218,6 +218,13 @@ complete_head_from_modules($conf,$langs,null,$head,$h,$type);
 
 dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
 
+$tmp_companies = $form->select_thirdparty_list($socid,'socid',$filter,1, 0, 0, array(), '', 1);
+//Array passed as an argument to Form::selectarray to build a proper select input
+$companies = array();
+
+foreach ($tmp_companies as $value) {
+	$companies[$value['value']] = $value['label'];
+}
 
 print '<div class="fichecenter"><div class="fichethirdleft">';
 
@@ -233,7 +240,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
 	print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
 	if ($mode == 'customer') $filter='s.client in (1,2,3)';
 	if ($mode == 'supplier') $filter='s.fournisseur = 1';
-	print $form->select_company($socid,'socid',$filter,1);
+	print $form->selectarray('socid', $companies, $socid, 1, 0, 0, 'style="width: 100%"');
 	print '</td></tr>';
 	// User
 	print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';

+ 21 - 12
htdocs/compta/prelevement/class/rejetprelevement.class.php

@@ -87,7 +87,7 @@ class RejetPrelevement
 
 		dol_syslog("RejetPrelevement::Create id $id");
 		$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
-		$facs = $this->getListInvoices();
+		$facs = $this->getListInvoices(1);
 
 		$this->db->begin();
 
@@ -132,7 +132,7 @@ class RejetPrelevement
 		for ($i = 0; $i < $num; $i++)
 		{
 			$fac = new Facture($this->db);
-			$fac->fetch($facs[$i]);
+			$fac->fetch($facs[$i][0]);
 
 			// Make a negative payment
 			$pai = new Paiement($this->db);
@@ -144,7 +144,7 @@ class RejetPrelevement
 			 * PHP installs sends only the part integer negative
 			*/
 
-			$pai->amounts[$facs[$i]] = price2num($fac->total_ttc * -1);
+			$pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * -1);
 			$pai->datepaye = $date_rejet;
 			$pai->paiementid = 3; // type of payment: withdrawal
 			$pai->num_paiement = $fac->ref;
@@ -152,7 +152,7 @@ class RejetPrelevement
 			if ($pai->create($this->user) < 0)  // we call with no_commit
 			{
 				$error++;
-				dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i]);
+				dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]);
 			}
 			else
 			{
@@ -270,22 +270,24 @@ class RejetPrelevement
 	}
 
 	/**
-	 *    Retrieve the list of invoices
+	 * Retrieve the list of invoices
 	 *
-	 *    @return	array
+	 * @param 	int		$amounts 	If you want to get the amount of the order for each invoice
+	 * @return	array				Array List of invoices related to the withdrawal line
+	 * @TODO	A withdrawal line is today linked to one and only one invoice. So the function should return only one object ?
 	 */
-	private function getListInvoices()
+	private function getListInvoices($amounts=0)
 	{
 		global $conf;
 
 		$arr = array();
 
 		 //Returns all invoices of a withdrawal
-		$sql = "SELECT f.rowid as facid";
+		$sql = "SELECT f.rowid as facid, pl.amount";
 		$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf";
-		$sql.= ", ".MAIN_DB_PREFIX."facture as f";
+		$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)";
+		$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON (pf.fk_prelevement_lignes = pl.rowid)";
 		$sql.= " WHERE pf.fk_prelevement_lignes = ".$this->id;
-		$sql.= " AND pf.fk_facture = f.rowid";
 		$sql.= " AND f.entity = ".$conf->entity;
 
 		$resql=$this->db->query($sql);
@@ -299,7 +301,14 @@ class RejetPrelevement
 				while ($i < $num)
 				{
 					$row = $this->db->fetch_row($resql);
-					$arr[$i] = $row[0];
+					if (!$amounts) $arr[$i] = $row[0];
+					else
+					{
+						$arr[$i] = array(
+							$row[0],
+							$row[1]
+						);
+					}
 					$i++;
 				}
 			}
@@ -307,7 +316,7 @@ class RejetPrelevement
 		}
 		else
 		{
-			dol_syslog("RejetPrelevement Erreur");
+			dol_syslog("getListInvoices", LOG_ERR);
 		}
 
 		return $arr;

+ 10 - 7
htdocs/compta/sociales/class/paymentsocialcontribution.class.php

@@ -317,16 +317,19 @@ class PaymentSocialContribution extends CommonObject
 		global $conf, $langs;
 		$error=0;
 
+		dol_syslog(get_class($this)."::delete");
+
 		$this->db->begin();
 
-	    if (! $error)
+	    if ($this->bank_line > 0)
         {
-            $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url";
-            $sql.= " WHERE type='payment_sc' AND url_id=".$this->id;
-
-            dol_syslog(get_class($this)."::delete", LOG_DEBUG);
-            $resql = $this->db->query($sql);
-            if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+        	$accline = new AccountLine($this->db);
+			$accline->fetch($this->bank_line);
+			$result = $accline->delete();
+			if($result < 0) {
+				$this->errors[] = $accline->error;
+				$error++;
+			}
         }
 
 		if (! $error)

+ 1 - 1
htdocs/contact/card.php

@@ -809,7 +809,7 @@ else
             print '</tr>';
 
             // Jabberid
-            print '<tr><td><label for="jabberid">'.$langs->trans("Jabberid").'</label></td>';
+            print '<tr><td><label for="jabberid">'.$langs->trans("IM").'</label></td>';
 	        print '<td><input name="jabberid" id="jabberid" type="text" size="40" maxlength="80" value="'.(isset($_POST["jabberid"])?$_POST["jabberid"]:$object->jabberid).'"></td>';
             if (! empty($conf->mailing->enabled))
             {

+ 1 - 1
htdocs/contact/class/contact.class.php

@@ -568,7 +568,7 @@ class Contact extends CommonObject
 
 				$this->country_id 		= $obj->country_id;
 				$this->country_code		= $obj->country_id?$obj->country_code:'';
-				$this->country			= ($obj->country_id > 0)?$langs->transnoentitiesnoconv("Country".$obj->country_code):'';
+				$this->country			= $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):'';
 
 				$this->socid			= $obj->fk_soc;
 				$this->socname			= $obj->socname;

+ 12 - 10
htdocs/contact/info.php

@@ -36,6 +36,8 @@ $contactid = GETPOST("id",'int');
 if ($user->societe_id) $socid=$user->societe_id;
 $result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
 
+$contact = new Contact($db);
+
 
 
 /*
@@ -45,23 +47,23 @@ $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("
 
 llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
 
+if ($contactid > 0)
+{
+	$result = $contact->fetch($contactid, $user);
 
-$contact = new Contact($db);
-$contact->fetch($contactid, $user);
-$contact->info($contactid);
-
+	$contact->info($contactid);
 
-$head = contact_prepare_head($contact);
 
-dol_fiche_head($head, 'info', $title, 0, 'contact');
+	$head = contact_prepare_head($contact);
 
+	dol_fiche_head($head, 'info', $title, 0, 'contact');
 
-print '<table width="100%"><tr><td>';
-print '</td></tr></table>';
+	// TODO Put here ref of card
 
-dol_print_object_info($contact);
+	dol_print_object_info($contact);
 
-print "</div>";
+	dol_fiche_end();
+}
 
 llxFooter();
 

+ 8 - 4
htdocs/contact/ldap.php

@@ -40,7 +40,10 @@ if ($user->societe_id) $socid=$user->societe_id;
 $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
 
 $contact = new Contact($db);
-$contact->fetch($id, $user);
+if ($id > 0)
+{
+	$contact->fetch($id, $user);
+}
 
 
 /*
@@ -132,7 +135,8 @@ print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur" c
 
 print '</table>';
 
-print '</div>';
+dol_fiche_end();
+
 
 /*
  * Barre d'actions
@@ -204,6 +208,6 @@ print '</table>';
 
 
 
-$db->close();
-
 llxFooter();
+
+$db->close();

+ 7 - 3
htdocs/contact/vcard.php

@@ -28,14 +28,20 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
 
+$contact = new Contact($db);
+
 
 $id = GETPOST('id', 'int');
 
 // Security check
 $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
 
-$contact = new Contact($db);
 $result=$contact->fetch($id);
+if (! $result)
+{
+	dol_print_error($contact->error);
+	exit;	
+}
 
 $physicalperson=1;
 
@@ -43,7 +49,6 @@ $company = new Societe($db);
 if ($contact->socid)
 {
 	$result=$company->fetch($contact->socid);
-	//print "ee";
 }
 
 // We create VCard
@@ -100,4 +105,3 @@ header("Connection: close");
 header("Content-Type: text/x-vcard; name=\"".$filename."\"");
 
 print $output;
-

+ 1 - 1
htdocs/core/actions_extrafields.inc.php

@@ -125,7 +125,7 @@ if ($action == 'add')
 	    if (! $error)
 	    {
     		// attrname must be alphabetical and lower case only
-    		if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname']))
+    		if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname']) && !is_numeric($_POST["attrname"]))
     		{
     			// Construct array for parameter (value of select list)
         		$default_value = GETPOST('default_value');

+ 2 - 1
htdocs/core/ajax/constantonoff.php

@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2011-2012 Regis Houssin  <regis.houssin@capnetworks.com>
+/* Copyright (C) 2011-2015 Regis Houssin  <regis.houssin@capnetworks.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
@@ -26,6 +26,7 @@ if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
 if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
 if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
 if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
+if (! defined('NOREQUIREHOOK'))  define('NOREQUIREHOOK','1');
 
 require '../../main.inc.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

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

@@ -33,6 +33,18 @@
 abstract class CommonDocGenerator
 {
 	var $error='';
+	protected $db;
+	
+	
+	/**
+	 *	Constructor
+	 *
+	 *  @param		DoliDB		$db      Database handler
+	*/
+	public function __construct($db) {
+		$this->db = $db;
+		return 1;
+	}
 
 
     /**

+ 1 - 1
htdocs/core/class/commonobject.class.php

@@ -352,7 +352,7 @@ abstract class CommonObject
 
 		$sql = "SELECT rowid, ref, ref_ext";
 		$sql.= " FROM ".MAIN_DB_PREFIX.$element;
-		$sql.= " WHERE entity IN (".getEntity($element,1).")" ;
+		$sql.= " WHERE entity IN (".getEntity($element, true).")" ;
 
 		if ($id > 0) $sql.= " AND rowid = ".$db->escape($id);
 		else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'";

+ 3 - 1
htdocs/core/class/html.form.class.php

@@ -984,7 +984,7 @@ class Form
                         $out.= '<option value="'.$obj->rowid.'">'.$label.'</option>';
                     }
 
-                    array_push($outarray, array('key'=>$obj->rowid, 'value'=>$obj->name, 'label'=>$obj->name));
+                    array_push($outarray, array('key'=>$obj->rowid, 'value'=>$obj->rowid, 'label'=>$label));
 
                     $i++;
                     if (($i % 10) == 0) $out.="\n";
@@ -2384,6 +2384,8 @@ class Form
 
         dol_syslog(__METHOD__, LOG_DEBUG);
 
+		$langs->load('propal');
+
         $sql = "SELECT rowid, code, label";
         $sql.= " FROM ".MAIN_DB_PREFIX.'c_availability';
         $sql.= " WHERE active > 0";

+ 1 - 1
htdocs/core/class/vcard.class.php

@@ -150,7 +150,7 @@ class vCard
     {
         $this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
         $this->filename = "$first%20$family.vcf";
-        if ($this->properties["FN"]=="") $this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
+        if (empty($this->properties["FN"])) $this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
     }
 
     /**

+ 0 - 1
htdocs/core/lib/files.lib.php

@@ -388,7 +388,6 @@ function dol_is_url($url)
     return false;
 }
 
-
 /**
  * 	Test if a folder is empty
  *

+ 24 - 19
htdocs/core/modules/DolibarrModules.class.php

@@ -203,7 +203,7 @@ abstract class DolibarrModules
 	// We should but can't set this as abstract because this will make dolibarr hang
 	// after migration due to old module not implementing. We must wait PHP is able to make
 	// a try catch on Fatal error to manage this correctly.
-	
+
     /**
      * Enables a module.
      * Inserts all informations into database
@@ -1392,7 +1392,7 @@ print $sql;
             $menu->user=$this->menu[$key]['user'];
             $menu->enabled=isset($this->menu[$key]['enabled'])?$this->menu[$key]['enabled']:0;
             $menu->position=$this->menu[$key]['position'];
-            
+
             if (! $err)
             {
                 $result=$menu->create($user);	// Save menu entry into table llx_menu
@@ -1587,7 +1587,6 @@ print $sql;
         global $conf;
 
         $error=0;
-        $entity=$conf->entity;
 
         if (is_array($this->module_parts) && ! empty($this->module_parts))
         {
@@ -1595,22 +1594,28 @@ print $sql;
             {
     			if (is_array($value) && count($value) == 0) continue;	// Discard empty arrays
 
-                $newvalue = $value;
-
-                // Serialize array parameters
-                if (is_array($value))
-                {
-                    // Can defined other parameters
-                    if (is_array($value['data']) && ! empty($value['data']))
-                    {
-                        $newvalue = json_encode($value['data']);
-                        if (isset($value['entity'])) $entity = $value['entity'];
-                    }
-                    else
-                    {
-                        $newvalue = json_encode($value);
-                    }
-                }
+    			$entity=$conf->entity; // Reset the current entity
+    			$newvalue = $value;
+
+    			// Serialize array parameters
+    			if (is_array($value))
+    			{
+    				// Can defined other parameters
+    				if (is_array($value['data']) && ! empty($value['data']))
+    				{
+    					$newvalue = json_encode($value['data']);
+    					if (isset($value['entity'])) $entity = $value['entity'];
+    				}
+    				else if (isset($value['data']) && !is_array($value['data']))
+    				{
+    					$newvalue = $value['data'];
+    					if (isset($value['entity'])) $entity = $value['entity'];
+    				}
+    				else
+    				{
+    					$newvalue = json_encode($value);
+    				}
+    			}
 
                 $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
                 $sql.= "name";

+ 7 - 0
htdocs/core/modules/export/export_csv.modules.php

@@ -252,6 +252,13 @@ class ExportCsv extends ModeleExports
 
 			$newvalue=$this->csv_clean($newvalue,$outputlangs->charset_output);
 
+			if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7))
+			{
+				$array = unserialize($typefield);
+				$array = $array['options'];
+				$newvalue = $array[$newvalue];
+			}
+			
 			fwrite($this->handle,$newvalue.$this->separator);
 			$this->col++;
 		}

+ 8 - 1
htdocs/core/modules/export/export_excel.modules.php

@@ -326,7 +326,14 @@ class ExportExcel extends ModeleExports
 
 			$newvalue=$this->excel_clean($newvalue);
 			$typefield=isset($array_types[$code])?$array_types[$code]:'';
-
+			
+			if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7))
+			{
+				$array = unserialize($typefield);
+				$array = $array['options'];
+				$newvalue = $array[$newvalue];
+			}
+			
 			// Traduction newvalue
 			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg))
 			{

+ 8 - 1
htdocs/core/modules/export/export_tsv.modules.php

@@ -226,7 +226,14 @@ class ExportTsv extends ModeleExports
 			if (preg_match('/^\((.*)\)$/i',$newvalue,$reg)) $newvalue=$outputlangs->transnoentities($reg[1]);
 
 			$newvalue=$this->tsv_clean($newvalue,$outputlangs->charset_output);
-
+			
+			if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7))
+			{
+				$array = unserialize($typefield);
+				$array = $array['options'];
+				$newvalue = $array[$newvalue];
+			}
+			
 			fwrite($this->handle,$newvalue.$this->separator);
             $this->col++;
 		}

+ 2 - 0
htdocs/core/modules/modSociete.class.php

@@ -360,6 +360,8 @@ class modSociete extends DolibarrModules
 						$tmpparam=unserialize($obj->param);	// $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
 						if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options']));
 						if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
+					case 'select':
+						$typeFilter="Select:".$obj->param;
 						break;
         		}
         		$this->export_fields_array[$r][$fieldname]=$fieldlabel;

+ 21 - 0
htdocs/core/tpl/document_actions_pre_headers.tpl.php

@@ -1,5 +1,6 @@
 <?php
 /* Copyright (C)    2013    Cédric Salvador    <csalvador@gpcsolutions.fr>
+ * Copyright (C)    2015    Marcos García      <marcosgdf@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
@@ -58,7 +59,27 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
 
         if ($urlfile)
         {
+	        $dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
+	        $dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette
+
             $ret = dol_delete_file($file, 0, 0, 0, $object);
+
+	        // Si elle existe, on efface la vignette
+	        if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i',$file,$regs))
+	        {
+		        $photo_vignette=basename(preg_replace('/'.$regs[0].'/i','',$file).'_small'.$regs[0]);
+		        if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
+		        {
+			        dol_delete_file($dirthumb.$photo_vignette);
+		        }
+
+		        $photo_vignette=basename(preg_replace('/'.$regs[0].'/i','',$file).'_mini'.$regs[0]);
+		        if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
+		        {
+			        dol_delete_file($dirthumb.$photo_vignette);
+		        }
+	        }
+
             if ($ret) setEventMessage($langs->trans("FileWasRemoved", $urlfile));
             else setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors');
         }

+ 1 - 1
htdocs/langs/en_US/errors.lang

@@ -65,7 +65,7 @@ ErrorNoValueForCheckBoxType=Please fill value for checkbox list
 ErrorNoValueForRadioType=Please fill value for radio list
 ErrorBadFormatValueList=The list value cannot have more than one come : <u>%s</u>, but need at least one: llave,valores
 ErrorFieldCanNotContainSpecialCharacters=Field <b>%s</b> must not contains special characters.
-ErrorFieldCanNotContainSpecialNorUpperCharacters=Field <b>%s</b> must not contains special characters, nor upper case characters.
+ErrorFieldCanNotContainSpecialNorUpperCharacters=Field <b>%s</b> must not contain special characters, nor upper case characters and cannot contain only numbers.
 ErrorNoAccountancyModuleLoaded=No accountancy module activated
 ErrorExportDuplicateProfil=This profile name already exists for this export set.
 ErrorLDAPSetupNotComplete=Dolibarr-LDAP matching is not complete.

+ 1 - 0
htdocs/langs/fr_FR/categories.lang

@@ -109,3 +109,4 @@ CategorieRecursivHelp=Si activé : quand un élément est ajouté dans une cat
 AddProductServiceIntoCategory=Ajouter le produit/service suivant
 ShowCategory=Afficher tag/catégorie
 ByDefaultInList=Par défaut dans la liste
+Translation=Traduction

+ 1 - 1
htdocs/main.inc.php

@@ -612,7 +612,7 @@ if (! defined('NOLOGIN'))
             exit;
         }
         else
-        {
+		{
 	       // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
 	       $hookmanager->initHooks(array('main'));
 

+ 1 - 1
htdocs/paypal/lib/paypal.lib.php

@@ -311,7 +311,7 @@ function getPaypalPaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f
     }
 
     // For multicompany
-    //$out.="&entity=".$conf->entity; // This should not be into link. Link contains already a ref of an object that allow to retreive entity
+    $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
 
     return $out;
 }

+ 5 - 5
htdocs/product/reassort.php

@@ -192,11 +192,11 @@ if ($resql)
 
 	if ($sref || $snom || $sall || GETPOST('search'))
 	{
-		print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
+		print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy.(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num);
 	}
 	else
 	{
-		print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num);
+		print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":"").(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num);
 	}
 
 	if (! empty($catid))
@@ -246,7 +246,7 @@ if ($resql)
 	print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder);
 	// TODO Add info of running suppliers/customers orders
 	//print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder);
-	print '<td class="liste_titre">&nbsp;</td>';
+	print_liste_field_titre('');
 	print_liste_field_titre($langs->trans("Sell"),$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
     print_liste_field_titre($langs->trans("Buy"),$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
 	print "</tr>\n";
@@ -342,11 +342,11 @@ if ($resql)
 	{
 		if ($sref || $snom || $sall || GETPOST('search'))
 		{
-	  		print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, '');
+	  		print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy.(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, '');
 		}
 		else
 		{
-	  		print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":"")."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, '');
+	  		print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":"")."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy.(!empty($search_categ) ? '&amp;search_categ='.$search_categ : '').(!empty($toolowstock) ? '&amp;toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, '');
 		}
 	}
 

+ 6 - 5
htdocs/projet/list.php

@@ -205,8 +205,10 @@ if ($resql)
 	$i = 0;
 
 	$param='';
+	if ($mine)				        $param.='&mode=mine';
 	if ($month)              		$param.='&month='.$month;
 	if ($year)               		$param.='&year=' .$year;
+	if ($socid)				        $param.='&socid='.$socid;
 	if ($search_all != '') 			$param.='&search_all='.$search_all;
 	if ($search_ref != '') 			$param.='&search_ref='.$search_ref;
 	if ($search_label != '') 		$param.='&search_label='.$search_label;
@@ -266,7 +268,6 @@ if ($resql)
     	print '</div>';
 	}
 
-
 	print '<table class="noborder" width="100%">';
 
 	print '<tr class="liste_titre">';
@@ -277,7 +278,7 @@ if ($resql)
 	if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE)) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,'align="center"',$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder);
-    if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) 
+    if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
     {
     	print_liste_field_titre($langs->trans("OpportunityAmountShort"),$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'',$sortfield,$sortorder);
     	print_liste_field_titre($langs->trans("OpportunityStatusShort"),$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'',$sortfield,$sortorder);
@@ -423,13 +424,13 @@ if ($resql)
     		print '</td>';
 
     		// Date start
-			if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE)) 
+			if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE))
 			{
 				print '<td class="center">';
 	    		print dol_print_date($db->jdate($objp->date_start),'day');
 	    		print '</td>';
 			}
-			
+
     		// Date end
     		print '<td class="center">';
     		print dol_print_date($db->jdate($objp->date_end),'day');
@@ -450,7 +451,7 @@ if ($resql)
     			print '<td>';
     			if ($objp->opp_status_code) print $langs->trans("OppAmount".$objp->opp_amount);
     			print '</td>';
-    			
+
     			print '<td>';
     			if ($objp->opp_status_code) print $langs->trans("OppStatusShort".$objp->opp_status_code);
     			print '</td>';

+ 21 - 10
htdocs/societe/info.php

@@ -40,6 +40,7 @@ $result = restrictedArea($user, 'societe', $socid, '&societe');
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
 $hookmanager->initHooks(array('infothirdparty'));
 
+$object = new Societe($db);
 
 
 /*
@@ -56,28 +57,38 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
  *	View
  */
 
-$object = new Societe($db);
-$object->fetch($socid);
-$object->info($socid);
-
 $title=$langs->trans("ThirdParty");
 if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Info");
 $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
 llxHeader('',$title,$help_url);
 
+if ($socid > 0)
+{
+	$result = $object->fetch($socid);
+	if (! $result)
+	{
+		$langs->load("errors");
+		print $langs->trans("ErrorRecordNotFound");
+
+		llxFooter();
+		$db->close();
 
-$head = societe_prepare_head($object);
+		exit;
+	}
 
-dol_fiche_head($head, 'info', $langs->trans("ThirdParty"),0,'company');
+	$object->info($socid);
 
+	$head = societe_prepare_head($object);
 
+	dol_fiche_head($head, 'info', $langs->trans("ThirdParty"), 0, 'company');
 
-print '<table width="100%"><tr><td>';
-dol_print_object_info($object);
-print '</td></tr></table>';
 
+	print '<table width="100%"><tr><td>';
+	dol_print_object_info($object);
+	print '</td></tr></table>';
 
-dol_fiche_end();
+	dol_fiche_end();
+}
 
 
 llxFooter();

+ 2 - 0
htdocs/societe/soc.php

@@ -1256,6 +1256,7 @@ else
         // 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
+        print $hookmanager->resPrint;
         if (empty($reshook) && ! empty($extrafields->attribute_label))
         {
         	print $object->showOptionals($extrafields,'edit');
@@ -1777,6 +1778,7 @@ else
             // 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
+            print $hookmanager->resPrint;
             if (empty($reshook) && ! empty($extrafields->attribute_label))
             {
             	print $object->showOptionals($extrafields,'edit');

+ 2 - 2
htdocs/webservices/server_productorservice.php

@@ -1095,11 +1095,11 @@ function getProductsForCategory($authentication,$id,$lang='')
 							$extrafields=new ExtraFields($db);
 							$extralabels=$extrafields->fetch_name_optionals_label('product',true);
 							//Get extrafield values
-							$product->fetch_optionals($obj->id,$extralabels);
+							$obj->fetch_optionals($obj->id,$extralabels);
 
 							foreach($extrafields->attribute_label as $key=>$label)
 							{
-								$products[$iProduct]=array_merge($products[$iProduct],array('options_'.$key => $product->array_options['options_'.$key]));
+								$products[$iProduct]=array_merge($products[$iProduct],array('options_'.$key => $obj->array_options['options_'.$key]));
 							}
 
 							$iProduct++;