Subversion Repositories eFlore/Applications.cel

Rev

Rev 416 | Go to most recent revision | Show entire file | Ignore 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
*
-
 
7
* @category  PHP
5
 
8
* @package   papyrus_bp
6
// Utilitaire mise a jour enregistrement inventaire 
-
 
7
 
-
 
8
 
9
* @author    David Delon <delon@tela-botanica.org>
9
Class InventoryCheck extends DBAccessor {
-
 
10
 
-
 
-
 
10
* @copyright 2010 Tela-Botanica
-
 
11
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 
12
* @version   SVN: <svn_id>
12
	var $config;
13
* @link      /doc/
13
	
-
 
Line -... Line 14...
-
 
14
*/
-
 
15
 
14
	function InventoryCheck($config) {
16
/**
-
 
17
 * 
15
 
18
 * Utilitaire mise a jour enregistrement inventaire
16
		$this->config=$config;
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 {
19
 
23
 
-
 
24
	function getRessource(){
20
	function getRessource(){
25
		
21
		
-
 
22
			$DB=$this->connectDB($this->config,'database_cel');
-
 
23
			
26
			return;
Line -... Line 27...
-
 
27
 
24
			
28
			$requete_obs ="SELECT id_observation, zone_geo, ce_zone_geo, date_observation, ce_utilisateur, courriel_utilisateur FROM cel_obs";
25
//			$query="SELECT id, location, id_location, date_observation, identifiant FROM cel_inventory WHERE transmission=1 ";
29
   		    
26
			$query="SELECT id, location, id_location, date_observation, identifiant FROM cel_inventory";
30
   		    $resultat_obs = $this->requeter($requete_obs);
Line 27... Line 31...
27
   		    $res =& $DB->query($query);
31
    
Line 28... Line 32...
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
    
36
    
33
			while ($row =& $res->fetchrow(DB_FETCHMODE_ASSOC)) {
37
			foreach ($observations as $obs) {
-
 
38
 
34
 
39
				if ($obs['ce_zone_geo']!="000null") {
Line 35... Line 40...
35
				if ($row['id_location']!="000null") {
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";
36
					$query="select * from locations where name = '".mysql_escape_string($row['location'])."' and code='".mysql_escape_string($row['id_location'])."' limit 1";
-
 
37
				}
41
				}
38
				else {
-
 
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 " ";
49
					print $row['identifiant']; 
52
					print $obs['mail_utilisateur']; 
50
					print " : ";
53
					print " : ";
Line 51... Line 54...
51
					print $row['location']; 
54
					print $obs['zone_geo']; 
52
					print " - ";
55
					print " - ";
53
					print $row['id_location']; 
-
 
54
					print " - ";
56
					print $obs['ce_zone_geo']; 
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'];
-
 
56
					$link_desc=' <a href="'.$lk.'">Correction</a>';
-
 
57
					print $link_desc;
57
					print " - ";
Line 58... Line 58...
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'];
59
					
59
					$link_desc=' <a href="'.$lk.'">Correction</a>';
60
				}
60
					print $link_desc;
Line 77... Line 77...
77
* Securisation acces utilisateur
77
* Securisation acces utilisateur
78
*
78
*
79
*
79
*
80
* 
80
* 
81
*/
81
*/
82
 
-
 
83
?>
82
?>
84
83