Blob Blame History Raw
Fixes since 0.70 finale

fix a memory leak		https://dev.indepnet.net:8080/glpi/changeset/6190
clean code			https://dev.indepnet.net:8080/glpi/changeset/6191
Correction reports		https://dev.indepnet.net:8080/glpi/changeset/6194
fix search end warranty		https://dev.indepnet.net:8080/glpi/changeset/6196
mailgate			https://dev.indepnet.net:8080/glpi/changeset/6226
mailgate			https://dev.indepnet.net:8080/glpi/changeset/6228

Index: branches/0.70-bugfixes/inc/rulesengine.class.php
===================================================================
--- trunk/inc/rulesengine.class.php (revision 6127)
+++ branches/0.70-bugfixes/inc/rulesengine.class.php (revision 6190)
@@ -67,4 +67,5 @@
 		 $result = $DB->query($sql);
 		if ($result){
+			$this->rule_list = array();
 		 	while ($rule=$DB->fetch_array($result)) {
 			 	//For each rule, get a Rule object with all the criterias and actions
Index: branches/0.70-bugfixes/inc/software.function.php
===================================================================
--- trunk/inc/software.function.php (revision 6096)
+++ branches/0.70-bugfixes/inc/software.function.php (revision 6191)
@@ -69,5 +69,5 @@
 			$nb_licences=$DB->result($result, 0, "COUNT");
 			$result_update = $DB->query($query_update);
-			$nb_updates=$DB->result($result_update, 0, "COUNT");;
+			$nb_updates=$DB->result($result_update, 0, "COUNT");
 			$installed = getInstalledLicence($sID);
 			$tobuy=getLicenceToBuy($sID);
@@ -128,5 +128,4 @@
 	
 					$params=array('type'=>'__VALUE__',
-							'sID'=>$sID,
 							'sID'=>$sID,
 					);
Index: branches/0.70-bugfixes/front/report.infocom.conso.php
===================================================================
--- trunk/front/report.infocom.conso.php (revision 5788)
+++ branches/0.70-bugfixes/front/report.infocom.conso.php (revision 6194)
@@ -204,5 +204,5 @@
 
 
-echo "<div align='center'><h3>".$LANG["common"][33].": ".$LANG["financial"][21]."=".number_format($valeurtot,$CFG_GLPI["decimal_number"])." - ".$LANG["financial"][81]."=".number_format($valeurnettetot,$CFG_GLPI["decimal_number"])."</h3></div>";
+echo "<div align='center'><h3>".$LANG["common"][33].": ".$LANG["financial"][21]."=".number_format($valeurtot,$CFG_GLPI["decimal_number"],"."," ")." - ".$LANG["financial"][81]."=".number_format($valeurnettetot,$CFG_GLPI["decimal_number"],"."," ")."</h3></div>";
 
 if (count($valeurnettegraphtot)>0){
Index: branches/0.70-bugfixes/front/report.infocom.php
===================================================================
--- trunk/front/report.infocom.php (revision 5857)
+++ branches/0.70-bugfixes/front/report.infocom.php (revision 6194)
@@ -160,5 +160,5 @@
 		$valeurnettetot+=$valeurnettesoustot;
 
-		echo "<tr><td colspan='6' class='center'><h3>".$LANG["common"][33].": ".$LANG["financial"][21]."=$valeursoustot - ".$LANG["financial"][81]."=$valeurnettesoustot</h3></td></tr>";
+		echo "<tr><td colspan='6' class='center'><h3>".$LANG["common"][33].": ".$LANG["financial"][21]."=".number_format($valeursoustot,$CFG_GLPI["decimal_number"],"."," ")." - ".$LANG["financial"][81]."=".number_format($valeurnettesoustot,$CFG_GLPI["decimal_number"],"."," ")."</h3></td></tr>";
 
 
@@ -221,5 +221,5 @@
 
 
-echo "<div align='center'><h3>".$LANG["common"][33].": ".$LANG["financial"][21]."=".number_format($valeurtot,$CFG_GLPI["decimal_number"])." - ".$LANG["financial"][81]."=".number_format($valeurnettetot,$CFG_GLPI["decimal_number"])."</h3></div>";
+echo "<div align='center'><h3>".$LANG["common"][33].": ".$LANG["financial"][21]."=".number_format($valeurtot,$CFG_GLPI["decimal_number"],"."," ")." - ".$LANG["financial"][81]."=".number_format($valeurnettetot,$CFG_GLPI["decimal_number"],"."," ")."</h3></div>";
 
 if (count($valeurnettegraphtot)>0){
Index: branches/0.70-bugfixes/inc/search.constant.php
===================================================================
--- trunk/inc/search.constant.php (revision 6154)
+++ branches/0.70-bugfixes/inc/search.constant.php (revision 6196)
@@ -373,14 +373,8 @@
 
 $SEARCH_OPTION[COMPUTER_TYPE][120]['table']='glpi_infocoms';
-$SEARCH_OPTION[COMPUTER_TYPE][120]['field']='end_warranty_buy';
+$SEARCH_OPTION[COMPUTER_TYPE][120]['field']='end_warranty';
 $SEARCH_OPTION[COMPUTER_TYPE][120]['linkfield']='';
-$SEARCH_OPTION[COMPUTER_TYPE][120]['name']=$LANG["financial"][14]." - ".$LANG["financial"][80];
+$SEARCH_OPTION[COMPUTER_TYPE][120]['name']=$LANG["financial"][80];
 $SEARCH_OPTION[COMPUTER_TYPE][120]['meta']=0;
-
-$SEARCH_OPTION[COMPUTER_TYPE][121]['table']='glpi_infocoms';
-$SEARCH_OPTION[COMPUTER_TYPE][121]['field']='end_warranty_buy';
-$SEARCH_OPTION[COMPUTER_TYPE][121]['linkfield']='';
-$SEARCH_OPTION[COMPUTER_TYPE][121]['name']=$LANG["financial"][76]." - ".$LANG["financial"][80];
-$SEARCH_OPTION[COMPUTER_TYPE][121]['meta']=0;
 
 $SEARCH_OPTION[COMPUTER_TYPE][53]['table']='glpi_enterprises_infocoms';
@@ -724,14 +718,8 @@
 
 $SEARCH_OPTION[NETWORKING_TYPE][120]['table']='glpi_infocoms';
-$SEARCH_OPTION[NETWORKING_TYPE][120]['field']='end_warranty_buy';
+$SEARCH_OPTION[NETWORKING_TYPE][120]['field']='end_warranty';
 $SEARCH_OPTION[NETWORKING_TYPE][120]['linkfield']='';
-$SEARCH_OPTION[NETWORKING_TYPE][120]['name']=$LANG["financial"][14]." - ".$LANG["financial"][80];
+$SEARCH_OPTION[NETWORKING_TYPE][120]['name']=$LANG["financial"][80];
 $SEARCH_OPTION[NETWORKING_TYPE][120]['meta']=0;
-
-$SEARCH_OPTION[NETWORKING_TYPE][121]['table']='glpi_infocoms';
-$SEARCH_OPTION[NETWORKING_TYPE][121]['field']='end_warranty_buy';
-$SEARCH_OPTION[NETWORKING_TYPE][121]['linkfield']='';
-$SEARCH_OPTION[NETWORKING_TYPE][121]['name']=$LANG["financial"][76]." - ".$LANG["financial"][80];
-$SEARCH_OPTION[NETWORKING_TYPE][121]['meta']=0;
 
 $SEARCH_OPTION[NETWORKING_TYPE][53]['table']='glpi_enterprises_infocoms';
@@ -1017,14 +1005,8 @@
 
 $SEARCH_OPTION[PRINTER_TYPE][120]['table']='glpi_infocoms';
-$SEARCH_OPTION[PRINTER_TYPE][120]['field']='end_warranty_buy';
+$SEARCH_OPTION[PRINTER_TYPE][120]['field']='end_warranty';
 $SEARCH_OPTION[PRINTER_TYPE][120]['linkfield']='';
-$SEARCH_OPTION[PRINTER_TYPE][120]['name']=$LANG["financial"][14]." - ".$LANG["financial"][80];
+$SEARCH_OPTION[PRINTER_TYPE][120]['name']=$LANG["financial"][80];
 $SEARCH_OPTION[PRINTER_TYPE][120]['meta']=0;
-
-$SEARCH_OPTION[PRINTER_TYPE][121]['table']='glpi_infocoms';
-$SEARCH_OPTION[PRINTER_TYPE][121]['field']='end_warranty_buy';
-$SEARCH_OPTION[PRINTER_TYPE][121]['linkfield']='';
-$SEARCH_OPTION[PRINTER_TYPE][121]['name']=$LANG["financial"][76]." - ".$LANG["financial"][80];
-$SEARCH_OPTION[PRINTER_TYPE][121]['meta']=0;
 
 $SEARCH_OPTION[PRINTER_TYPE][53]['table']='glpi_enterprises_infocoms';
@@ -1265,15 +1247,8 @@
 
 $SEARCH_OPTION[MONITOR_TYPE][120]['table']='glpi_infocoms';
-$SEARCH_OPTION[MONITOR_TYPE][120]['field']='end_warranty_buy';
+$SEARCH_OPTION[MONITOR_TYPE][120]['field']='end_warranty';
 $SEARCH_OPTION[MONITOR_TYPE][120]['linkfield']='';
-$SEARCH_OPTION[MONITOR_TYPE][120]['name']=$LANG["financial"][14]." - ".$LANG["financial"][80];
+$SEARCH_OPTION[MONITOR_TYPE][120]['name']=$LANG["financial"][80];
 $SEARCH_OPTION[MONITOR_TYPE][120]['meta']=0;
-
-$SEARCH_OPTION[MONITOR_TYPE][121]['table']='glpi_infocoms';
-$SEARCH_OPTION[MONITOR_TYPE][121]['field']='end_warranty_buy';
-$SEARCH_OPTION[MONITOR_TYPE][121]['linkfield']='';
-$SEARCH_OPTION[MONITOR_TYPE][121]['name']=$LANG["financial"][76]." - ".$LANG["financial"][80];
-$SEARCH_OPTION[MONITOR_TYPE][121]['meta']=0;
-
 
 $SEARCH_OPTION[MONITOR_TYPE][53]['table']='glpi_enterprises_infocoms';
@@ -1553,14 +1528,8 @@
 
 $SEARCH_OPTION[PERIPHERAL_TYPE][120]['table']='glpi_infocoms';
-$SEARCH_OPTION[PERIPHERAL_TYPE][120]['field']='end_warranty_buy';
+$SEARCH_OPTION[PERIPHERAL_TYPE][120]['field']='end_warranty';
 $SEARCH_OPTION[PERIPHERAL_TYPE][120]['linkfield']='';
-$SEARCH_OPTION[PERIPHERAL_TYPE][120]['name']=$LANG["financial"][14]." - ".$LANG["financial"][80];
+$SEARCH_OPTION[PERIPHERAL_TYPE][120]['name']=$LANG["financial"][80];
 $SEARCH_OPTION[PERIPHERAL_TYPE][120]['meta']=0;
-
-$SEARCH_OPTION[PERIPHERAL_TYPE][121]['table']='glpi_infocoms';
-$SEARCH_OPTION[PERIPHERAL_TYPE][121]['field']='end_warranty_buy';
-$SEARCH_OPTION[PERIPHERAL_TYPE][121]['linkfield']='';
-$SEARCH_OPTION[PERIPHERAL_TYPE][121]['name']=$LANG["financial"][76]." - ".$LANG["financial"][80];
-$SEARCH_OPTION[PERIPHERAL_TYPE][121]['meta']=0;
 
 $SEARCH_OPTION[PERIPHERAL_TYPE][53]['table']='glpi_enterprises_infocoms';
@@ -1790,14 +1759,8 @@
 
 $SEARCH_OPTION[SOFTWARE_TYPE][120]['table']='glpi_infocoms';
-$SEARCH_OPTION[SOFTWARE_TYPE][120]['field']='end_warranty_buy';
+$SEARCH_OPTION[SOFTWARE_TYPE][120]['field']='end_warranty';
 $SEARCH_OPTION[SOFTWARE_TYPE][120]['linkfield']='';
-$SEARCH_OPTION[SOFTWARE_TYPE][120]['name']=$LANG["financial"][14]." - ".$LANG["financial"][80];
+$SEARCH_OPTION[SOFTWARE_TYPE][120]['name']=$LANG["financial"][80];
 $SEARCH_OPTION[SOFTWARE_TYPE][120]['meta']=0;
-
-$SEARCH_OPTION[SOFTWARE_TYPE][121]['table']='glpi_infocoms';
-$SEARCH_OPTION[SOFTWARE_TYPE][121]['field']='end_warranty_buy';
-$SEARCH_OPTION[SOFTWARE_TYPE][121]['linkfield']='';
-$SEARCH_OPTION[SOFTWARE_TYPE][121]['name']=$LANG["financial"][76]." - ".$LANG["financial"][80];
-$SEARCH_OPTION[SOFTWARE_TYPE][121]['meta']=0;
 
 $SEARCH_OPTION[SOFTWARE_TYPE][53]['table']='glpi_enterprises_infocoms';
@@ -2665,14 +2628,8 @@
 
 $SEARCH_OPTION[PHONE_TYPE][120]['table']='glpi_infocoms';
-$SEARCH_OPTION[PHONE_TYPE][120]['field']='end_warranty_buy';
+$SEARCH_OPTION[PHONE_TYPE][120]['field']='end_warranty';
 $SEARCH_OPTION[PHONE_TYPE][120]['linkfield']='';
-$SEARCH_OPTION[PHONE_TYPE][120]['name']=$LANG["financial"][14]." - ".$LANG["financial"][80];
+$SEARCH_OPTION[PHONE_TYPE][120]['name']=$LANG["financial"][80];
 $SEARCH_OPTION[PHONE_TYPE][120]['meta']=0;
-
-$SEARCH_OPTION[PHONE_TYPE][121]['table']='glpi_infocoms';
-$SEARCH_OPTION[PHONE_TYPE][121]['field']='end_warranty_buy';
-$SEARCH_OPTION[PHONE_TYPE][121]['linkfield']='';
-$SEARCH_OPTION[PHONE_TYPE][121]['name']=$LANG["financial"][76]." - ".$LANG["financial"][80];
-$SEARCH_OPTION[PHONE_TYPE][121]['meta']=0;
 
 $SEARCH_OPTION[PHONE_TYPE][53]['table']='glpi_enterprises_infocoms';
Index: branches/0.70-bugfixes/inc/search.function.php
===================================================================
--- trunk/inc/search.function.php (revision 6154)
+++ branches/0.70-bugfixes/inc/search.function.php (revision 6196)
@@ -45,5 +45,5 @@
 	$todel=array();
 	if (!haveRight('contract_infocom',$action)&&in_array($type,$CFG_GLPI["infocom_types"])){
-		$todel=array_merge($todel,array('financial',25,26,27,28,29,30,37,38,50,51,52,53,54,55,56,57,58,59,120,121,122));
+		$todel=array_merge($todel,array('financial',25,26,27,28,29,30,37,38,50,51,52,53,54,55,56,57,58,59,120,122));
 	}
 
@@ -1389,9 +1389,6 @@
 			return " ORDER BY ADDDATE(glpi_contracts.begin_date, INTERVAL glpi_contracts.duration MONTH) $order ";
 		break;
-		case "glpi_infocoms.end_warranty_buy":
+		case "glpi_infocoms.end_warranty":
 			return " ORDER BY ADDDATE(glpi_infocoms.buy_date, INTERVAL glpi_infocoms.warranty_duration MONTH) $order ";
-		break;
-		case "glpi_infocoms.end_warranty_use":
-			return " ORDER BY ADDDATE(glpi_infocoms.use_date, INTERVAL glpi_infocoms.warranty_duration MONTH) $order ";
 		break;
 		case "glpi_contracts.expire":
@@ -1571,9 +1568,6 @@
 			return $pretable.$table.$addtable.".begin_date AS ".$NAME."_$num, ".$pretable.$table.$addtable.".duration AS ".$NAME."_".$num."_2, ";
 		break;
-		case "glpi_infocoms.end_warranty_buy":
+		case "glpi_infocoms.end_warranty":
 			return $pretable.$table.$addtable.".buy_date AS ".$NAME."_$num, ".$pretable.$table.$addtable.".warranty_duration AS ".$NAME."_".$num."_2, ";
-		break;
-		case "glpi_infocoms.end_warranty_use":
-			return $pretable.$table.$addtable.".use_date AS ".$NAME."_$num, ".$pretable.$table.$addtable.".warranty_duration AS ".$NAME."_".$num."_2, ";
 		break;
 		case "glpi_contracts.expire_notice" : // ajout jmd
@@ -1763,6 +1757,5 @@
 			break;
 
-		case "glpi_infocoms.end_warranty_use" :
-		case "glpi_infocoms.end_warranty_buy" :
+		case "glpi_infocoms.end_warranty" :
 		case "glpi_contracts.end_date" :
 		case "glpi_ocs_link.last_update":
@@ -1789,8 +1782,5 @@
 					$date_computation=" ADDDATE($table.begin_date, INTERVAL $table.duration MONTH) ";
 					break;
-				case "glpi_infocoms.end_warranty_use":
-					$date_computation=" ADDDATE($table.use_date, INTERVAL $table.warranty_duration MONTH) ";
-					break;
-				case "glpi_infocoms.end_warranty_buy":
+				case "glpi_infocoms.end_warranty":
 					$date_computation=" ADDDATE($table.buy_date, INTERVAL $table.warranty_duration MONTH) ";
 					break;
@@ -2522,6 +2512,5 @@
 			return convDateTime($data["ITEM_$num"]);
 			break;
-		case "glpi_infocoms.end_warranty_use":
-		case "glpi_infocoms.end_warranty_buy":
+		case "glpi_infocoms.end_warranty":
 		case "glpi_contracts.end_date":
 			if ($data["ITEM_$num"]!=''&&$data["ITEM_$num"]!="0000-00-00"){
Index: branches/0.70-bugfixes/inc/mailgate.class.php
===================================================================
--- trunk/inc/mailgate.class.php (revision 6096)
+++ branches/0.70-bugfixes/inc/mailgate.class.php (revision 6226)
@@ -260,4 +260,6 @@
 		// Mail request type
 		$tkt['request_type']=2;
+		// AUto_import
+		$tkt['_auto_import']=1;
 		$body=$this->getBody($i);
 		
Index: branches/0.70-bugfixes/inc/tracking.class.php
===================================================================
--- branches/0.70-bugfixes/inc/tracking.class.php (revision 6177)
+++ branches/0.70-bugfixes/inc/tracking.class.php (revision 6226)
@@ -414,12 +414,19 @@
 		unset($input["type"]);
 
-		if (!isset($input["author"])){
+		// No Auto set Import for external source
+		if (!isset($input['_auto_import'])&&!isset($input["author"])){
 			if (isset($_SESSION["glpiID"])&&$_SESSION["glpiID"]>0)
 				$input["author"]=$_SESSION["glpiID"];
 			else $input["author"]=1; // Helpdesk injector
-		}
-
-		if (isset($_SESSION["glpiID"])) $input["recipient"]=$_SESSION["glpiID"];
-		else if ($input["author"]) $input["recipient"]=$input["author"];
+		} else {
+			$input["author"]=0;
+		}
+
+		// No Auto set Import for external source
+		if (isset($_SESSION["glpiID"])&&!isset($input['_auto_import'])) {
+				$input["recipient"]=$_SESSION["glpiID"];
+		} else if ($input["author"]) {
+			$input["recipient"]=$input["author"];
+		}
 
 		if (!isset($input["request_type"])) $input["request_type"]=1;
@@ -440,5 +447,4 @@
 			$input["computer"]=0;
 		}
-
 
 		// Auto group define
Index: branches/0.70-bugfixes/inc/tracking.class.php
===================================================================
--- branches/0.70-bugfixes/inc/tracking.class.php (revision 6226)
+++ branches/0.70-bugfixes/inc/tracking.class.php (revision 6228)
@@ -415,15 +415,15 @@
 
 		// No Auto set Import for external source
-		if (!isset($input['_auto_import'])&&!isset($input["author"])){
-			if (isset($_SESSION["glpiID"])&&$_SESSION["glpiID"]>0)
-				$input["author"]=$_SESSION["glpiID"];
-			else $input["author"]=1; // Helpdesk injector
-		} else {
-			$input["author"]=0;
+		if (!isset($input['_auto_import'])){
+			if (!isset($input["author"])){
+				if (isset($_SESSION["glpiID"])&&$_SESSION["glpiID"]>0)
+					$input["author"]=$_SESSION["glpiID"];
+				else $input["author"]=1; // Helpdesk injector
+			}
 		}
 
 		// No Auto set Import for external source
 		if (isset($_SESSION["glpiID"])&&!isset($input['_auto_import'])) {
-				$input["recipient"]=$_SESSION["glpiID"];
+			$input["recipient"]=$_SESSION["glpiID"];
 		} else if ($input["author"]) {
 			$input["recipient"]=$input["author"];