Subversion Repositories eFlore/Applications.cel

Rev

Rev 416 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 416 Rev 901
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
// ATTENTION ! Classe compatible uniquement avec nouveau format de bdd du cel //
Line 2... Line 3...
2
 
3
 
3
// In utf8
4
/**
4
// Out utf8
5
* PHP Version 5
-
 
6
*
5
 
7
* @category  PHP
6
// Utilitaire mise a jour enregistrement inventaire 
-
 
7
 
-
 
8
 
8
* @package   papyrus_bp
9
Class InventoryCheck extends DBAccessor {
-
 
10
 
-
 
11
 
9
* @author    David Delon <delon@tela-botanica.org>
12
	var $config;
-
 
-
 
10
* @copyright 2010 Tela-Botanica
13
	
11
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
14
	function InventoryCheck($config) {
-
 
15
 
12
* @version   SVN: <svn_id>
16
		$this->config=$config;
13
* @link      /doc/
Line -... Line 14...
-
 
14
*/
-
 
15
 
-
 
16
/**
-
 
17
 * 
-
 
18
 * Utilitaire mise a jour enregistrement inventaire
-
 
19
 * A voir avec David mais ne devrait plus être décidé 
-
 
20
 * 
Line 17... Line 21...
17
	}
21
 */
Line 18... Line 22...
18
	
22
class InventoryCheck extends Cel {
Line -... Line 23...
-
 
23
 
Line 19... Line -...
19
 
-
 
20
	function getRessource(){
-
 
21
		
24
	function getRessource(){
Line -... Line 25...
-
 
25
		
22
			$DB=$this->connectDB($this->config,'database_cel');
26
			return;
23
			
27
 
24
			
28
			$requete_obs ="SELECT id_observation, zone_geo, ce_zone_geo, date_observation, ce_utilisateur, courriel_utilisateur FROM cel_obs";
Line 25... Line 29...
25
//			$query="SELECT id, location, id_location, date_observation, identifiant FROM cel_inventory WHERE transmission=1 ";
29
   		    
Line 26... Line 30...
26
			$query="SELECT id, location, id_location, date_observation, identifiant FROM cel_inventory";
30
   		    $resultat_obs = $this->requeter($requete_obs);
27
   		    $res =& $DB->query($query);
31
    
28
    
32
    		$observations = array();
29
	        if (DB::isError($res)) {
33
	        if (is_array($resultat_obs)) {
30
    	        die($res->getMessage());
34
    	        $observations = $resultat_obs;
31
        	}
35
        	}
32
    
-
 
Line 33... Line 36...
33
			while ($row =& $res->fetchrow(DB_FETCHMODE_ASSOC)) {
36
    
-
 
37
			foreach ($observations as $obs) {
34
 
38
 
35
				if ($row['id_location']!="000null") {
39
				if ($obs['ce_zone_geo']!="000null") {
36
					$query="select * from locations where name = '".mysql_escape_string($row['location'])."' and code='".mysql_escape_string($row['id_location'])."' limit 1";
-
 
37
				}
40
					$requete_lieu = "select * from cel_zones_geo where nom = '".mysql_escape_string($obs['zone_geo'])."' and id_zone_geo='".mysql_escape_string($obs['ce_zone_geo'])."' limit 1";
38
				else {
41
				}
39
					$query="select * from locations where name = '".mysql_escape_string($row['location'])."' limit 1";
42
				else {
40
				}
43
					$requete_lieu = "select * from cel_zones_geo where name = '".mysql_escape_string($obs['zone_geo'])."' limit 1";
41
				$resloc =& $DB->query($query);
44
				}
42
    
45
				
43
		        if (DB::isError($resloc)) {
46
				$res_loc = $this->requeter($requete_lieu);
44
    		        die($resloc->getMessage());
47
    
45
        		}
48
		        if (is_array($res_loc) && count($res_loc) > 0) {
46
				if ($resloc->numRows() == 0) {
49
		        	
47
					print $row['id']; 
50
					print $obs['id_observation']; 
48
					print " ";
51
					print " ";
Line 49... Line 52...
49
					print $row['identifiant']; 
52
					print $obs['mail_utilisateur']; 
50
					print " : ";
53
					print " : ";
51
					print $row['location']; 
-
 
52
					print " - ";
54
					print $obs['zone_geo']; 
53
					print $row['id_location']; 
-
 
54
					print " - ";
-
 
55
					$lk="http://www.tela-botanica.org/cel/jrest/util/cel_inventory.php?PME_sys_fl=0&PME_sys_fm=0&PME_sys_sfn[0]=0&PME_sys_operation=PME_op_Change&PME_sys_rec=".$row['id'];
55
					print " - ";
Line 56... Line 56...
56
					$link_desc=' <a href="'.$lk.'">Correction</a>';
56
					print $obs['ce_zone_geo']; 
57
					print $link_desc;
57
					print " - ";
58
					print "<br>";
58
					$lk="http://www.tela-botanica.org/cel/jrest/util/cel_inventory.php?PME_sys_fl=0&PME_sys_fm=0&PME_sys_sfn[0]=0&PME_sys_operation=PME_op_Change&PME_sys_rec=".$obs['id_observation'];
Line 77... Line 77...
77
* Securisation acces utilisateur
77
* Securisation acces utilisateur
78
*
78
*
79
*
79
*
80
* 
80
* 
81
*/
81
*/
82
 
-
 
83
?>
82
?>