Browse Source

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

Conflicts:
	htdocs/adherents/class/adherent.class.php
	htdocs/adherents/fiche.php
	htdocs/core/lib/date.lib.php
	htdocs/langs/fr_FR/bills.lang
	htdocs/resource/class/resource.class.php
Laurent Destailleur 10 years ago
parent
commit
5e0946bdc2

+ 10 - 5
ChangeLog

@@ -163,18 +163,20 @@ Dolibarr better:
 
 
 ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
-- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice
-- Fix: bug 1588 : relative discount
+- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
+- Fix: bug 1588 : relative discount.
 - Fix: label of input method not tranlated.
 - Fix: box of customer and propsects were not correctly disabled.
-- Fix: right and error management #1961
-- Fix: Fix Error when trying to clone an Order #1943
 - Fix: [ bug #1618 ] PHP Error thrown when saving a barcode
+- Fix: Civility & birthdate wasn't save into adherent module.
+- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref
+- Fix: Chars - is no more allowed into value for code for extra fields.
+( Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache
 
 ***** ChangeLog for 3.6.1 compared to 3.6.* *****
 For users:
 - Fix: Can upload files on services.
-- Fix: sql errors on updat fichinter.
+- Fix: sql errors on update fichinter.
 - Fix: debian script syntax error.
 - Fix: error "menu param is not inside list" into pos module.
 - Fix: Salary payments are not reflected on the reporting sheets.
@@ -310,6 +312,9 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
 - Remove add_photo_web() that is ot used anymore by core code.
 
 
+***** ChangeLog for 3.5.6 compared to 3.5.5 *****
+Fix: Avoid missing class error for fetch_thirdparty method #1973
+
 ***** ChangeLog for 3.5.5 compared to 3.5.4 *****
 Fix: Holiday module was broken. Initializaion of amount of holidays failed.
 Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas.

+ 2 - 1
htdocs/adherents/admin/adherent_type_extrafields.php

@@ -7,7 +7,7 @@
  *
  * 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
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -17,6 +17,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * or see http://www.gnu.org/
  */
 
 /**

+ 1 - 1
htdocs/adherents/card.php

@@ -723,7 +723,7 @@ else
 	{
 		/* ************************************************************************** */
 		/*                                                                            */
-		/* Fiche creation                                                             */
+		/* Creation card                                                             */
 		/*                                                                            */
 		/* ************************************************************************** */
 		$object->canvas=$canvas;

+ 4 - 3
htdocs/adherents/class/adherent.class.php

@@ -5,6 +5,7 @@
  * Copyright (C) 2004		Sebastien Di Cintio		<sdicintio@ressource-toi.org>
  * Copyright (C) 2004		Benoit Mortier			<benoit.mortier@opensides.be>
  * Copyright (C) 2009-2012	Regis Houssin			<regis.houssin@capnetworks.com>
+ * Copyright (C) 2014		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
@@ -124,7 +125,7 @@ class Adherent extends CommonObject
 
 
     /**
-     *  Fonction envoyant un email a l'adherent avec le texte fourni en parametre.
+     *  Function sending an email has the adherent with the text supplied in parameter.
      *
      *  @param	string	$text				Content of message (not html entities encoded)
      *  @param	string	$subject			Subject of message
@@ -247,9 +248,9 @@ class Adherent extends CommonObject
 
 
     /**
-     *	Renvoie le libelle traduit de la nature d'un adherent (physique ou morale)
+     *	Return translated label by the nature of a adherent (physical or moral)
      *
-     *	@param	string		$morphy		Nature physique ou morale de l'adherent
+     *	@param	string		$morphy		Nature of the adherent (physical or moral)
      *	@return	string					Label
      */
     function getmorphylib($morphy='')

+ 2 - 0
htdocs/core/class/commonobject.class.php

@@ -609,6 +609,8 @@ abstract class CommonObject
 
         if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty)) return 0;
 
+	    require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+
         $thirdparty = new Societe($this->db);
         $result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty));
         $this->client = $thirdparty;  // deprecated

+ 14 - 6
htdocs/core/class/extrafields.class.php

@@ -157,7 +157,7 @@ class ExtraFields
 	{
 		$table=$elementtype.'_extrafields';
 
-		if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
+		if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname))
 		{
 			if ($type=='boolean') {
 				$typedb='int';
@@ -752,15 +752,17 @@ class ExtraFields
 					if (strpos($InfoFieldList[4], 'extra')!==false)
 					{
 						$sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra';
-						$sqlwhere.= ' AND extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4];
+						$sqlwhere.= ' WHERE extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4];
 					}
 					else
 					{
-						$sqlwhere.= ' AND '.$InfoFieldList[4];
+						$sqlwhere.= ' WHERE '.$InfoFieldList[4];
 					}
+				}else {
+					$sqlwhere.= ' WHERE 1';
 				}
 				if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity;	// Some tables may have field, some other not. For the moment we disable it.
-				$sql.=preg_replace('/^ AND /','',$sqlwhere);
+				//$sql.=preg_replace('/^ AND /','',$sqlwhere);
 				//print $sql;
 
 				dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
@@ -988,7 +990,10 @@ class ExtraFields
 				{
 					foreach ($fields_label as $field_toshow)
 					{
-						$translabel=$langs->trans($obj->$field_toshow);
+						$translabel='';
+						if (!empty($obj->$field_toshow)) {
+							$translabel=$langs->trans($obj->$field_toshow);
+						}
 						if ($translabel!=$field_toshow) {
 							$value.=dol_trunc($translabel,18).' ';
 						}else {
@@ -998,7 +1003,10 @@ class ExtraFields
 				}
 				else
 				{
-					$translabel=$langs->trans($obj->$InfoFieldList[1]);
+					$translabel='';
+					if (!empty($obj->$InfoFieldList[1])) {
+						$translabel=$langs->trans($obj->$InfoFieldList[1]);
+					}
 					if ($translabel!=$obj->$InfoFieldList[1]) {
 						$value=dol_trunc($translabel,18);
 					}else {

+ 2 - 1
htdocs/core/class/html.formcron.class.php

@@ -4,7 +4,7 @@
  *
  * 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
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -14,6 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * or see http://www.gnu.org/
  */
 
 /**

+ 14 - 13
htdocs/core/lib/invoice2.lib.php

@@ -2,19 +2,20 @@
 /*
  * Copyright (C) 2009-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
 *
-* 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
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * or see http://www.gnu.org/
+ */
 
 /**
  *      \file       htdocs/core/lib/invoice2.lib.php

+ 1 - 0
htdocs/core/modules/action/rapport.pdf.php

@@ -210,6 +210,7 @@ class CommActionRapport
 		$sql.= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid";
 		$sql.= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year,$this->month,false))."'";
 		$sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'";
+		$sql.= " AND a.entity = ".$conf->entity;
 		$sql.= " ORDER BY a.datep DESC";
 
 		$eventstatic=new ActionComm($this->db);

BIN
htdocs/install/mssql/functions/functions.sql


+ 3 - 1
htdocs/langs/en_US/resource.lang

@@ -32,4 +32,6 @@ ResourceLinkedWithSuccess=Resource linked with success
 TitleResourceCard=Resource card
 ConfirmDeleteResource=Confirm to delete this resource
 RessourceSuccessfullyDeleted=Resource successfully deleted
-DictionaryResourceType=Type of resources
+DictionaryResourceType=Type of resources
+
+SelectResource=Select resource

+ 3 - 1
htdocs/langs/fr_FR/resource.lang

@@ -32,4 +32,6 @@ ResourceLinkedWithSuccess=Ressource liée avec succès
 TitleResourceCard=Fiche ressource
 ConfirmDeleteResource=Confirmer la suppression de cette ressource?
 RessourceSuccessfullyDeleted=Ressource effacée avec succès
-DictionaryResourceType=Type de ressources
+DictionaryResourceType=Type de ressources
+
+SelectResource=Sélectionner la ressource

+ 2 - 5
htdocs/projet/class/task.class.php

@@ -770,7 +770,7 @@ class Task extends CommonObject
         if ($this->db->query($sql) )
         {
             $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time");
-            $ret = $tasktme_id;
+            $ret = $tasktime_id;
 
             if (! $notrigger)
             {
@@ -801,10 +801,7 @@ class Task extends CommonObject
                 $this->db->rollback();
                 $ret = -2;
             }
-        }
-
-		if ($ret >= 0)
-        {
+        
             $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time";
             $sql.= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")";
             $sql.= " WHERE rowid = ".$tasktime_id;

+ 15 - 14
htdocs/resource/class/html.formresource.class.php

@@ -1,19 +1,20 @@
 <?php
 /* Copyright (C) - 2013	Jean-François FERRY	<jfefe@aternatik.fr>
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * or see http://www.gnu.org/
+ */
 
 /**
  *       \file       place/class/html.place.class.php

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

@@ -23,8 +23,8 @@
  */
 
 // Put here all includes required by your class file
-require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
-
+require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";
+require_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php";
 
 /**
  *	DAO Resource object
@@ -329,7 +329,7 @@ class Resource extends CommonObject
     function delete($rowid, $notrigger=0)
     {
         global $user,$langs,$conf;
-    
+
         $error=0;
 
         if (! $notrigger)
@@ -339,10 +339,10 @@ class Resource extends CommonObject
             if ($result < 0) return -1;
             // End call triggers
         }
-        
+
         $sql = "DELETE FROM ".MAIN_DB_PREFIX."resource";
         $sql.= " WHERE rowid =".$rowid;
-    
+
         dol_syslog(get_class($this)."::delete", LOG_DEBUG);
         if ($this->db->query($sql))
         {
@@ -364,7 +364,7 @@ class Resource extends CommonObject
             return -1;
         }
     }
-    
+
     /**
      *	Load resource objects into $this->lines
      *
@@ -500,9 +500,9 @@ class Resource extends CommonObject
    					$line->fk_user_create	=	$obj->fk_user_create;
 
 					if($obj->resource_id && $obj->resource_type)
-						$line->objresource = $this->fetchObjectByElement($obj->resource_id,$obj->resource_type);
+						$line->objresource = fetchObjectByElement($obj->resource_id,$obj->resource_type);
 					if($obj->element_id && $obj->element_type)
-						$line->objelement = $this->fetchObjectByElement($obj->element_id,$obj->element_type);
+						$line->objelement = fetchObjectByElement($obj->element_id,$obj->element_type);
         			$this->lines[$i] = $line;
 
    					$i++;
@@ -584,7 +584,7 @@ class Resource extends CommonObject
     				$line->mandatory		=	$obj->mandatory;
     				$line->fk_user_create	=	$obj->fk_user_create;
 
-    				$this->lines[$i] = $this->fetchObjectByElement($obj->resource_id,$obj->resource_type);
+    				$this->lines[$i] = fetchObjectByElement($obj->resource_id,$obj->resource_type);
 
     				$i++;
     			}
@@ -732,7 +732,7 @@ class Resource extends CommonObject
 			{
                 // Call trigger
                 $result=$this->call_trigger('RESOURCE_MODIFY',$user);
-                if ($result < 0) $error++;          
+                if ($result < 0) $error++;
                 // End call triggers
 	    	}
 		}
@@ -802,7 +802,7 @@ class Resource extends CommonObject
     	$i=0;
     	foreach($resources as $nb => $resource)
     	{
-    		$this->lines[$i] = $this->fetchObjectByElement($resource['resource_id'],$resource['resource_type']);
+    		$this->lines[$i] = fetchObjectByElement($resource['resource_id'],$resource['resource_type']);
     		$i++;
     	}
     	return $i;

+ 1 - 1
htdocs/webservices/server_thirdparty.php

@@ -460,7 +460,7 @@ function createThirdParty($authentication,$thirdparty)
         $result=$newobject->create($fuser);
         if ($newobject->particulier && $result > 0) {
             $newobject->firstname = $thirdparty['firstname'];
-            $newobject->name_bis = $thirdparty['ref'];
+            $newobject->name_bis = $thirdparty['lastname'];
             $result = $newobject->create_individual($fuser);
         }
         if ($result <= 0)