Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 416 Rev 762
Line 1... Line 1...
1
<?php
1
<?php
Line 2... Line 2...
2
 
2
 
3
// In : utf8
3
// In : utf8
4
// out : utf8
4
// out : utf8
5
// Transmission observation vers Tela
-
 
6
 
-
 
7
 
5
// Transmission observation vers Tela
8
Class InventoryTransmit extends DBAccessor  {
-
 
9
 
-
 
10
 
-
 
11
	var $config;
-
 
12
	
-
 
13
	function InventoryTransmit($config) {
-
 
14
 
-
 
15
		$this->config=$config;
-
 
16
	}
-
 
17
	
-
 
Line 18... Line 6...
18
 
6
class InventoryTransmit extends Cel  {
Line 19... Line 7...
19
 
7
 
20
	function updateElement($uid,$pairs) {
8
	function updateElement($uid,$pairs) {
21
		
9
		
22
		 // Controle detournement utilisateur 
-
 
23
		    session_start();
-
 
Line 24... Line 10...
24
 	        $this->controleUtilisateur($uid[0]);
10
		// Controle detournement utilisateur 
25
 
11
		session_start();
26
		$DB=$this->connectDB($this->config,'database_cel');
12
 	    $this->controleUtilisateur($uid[0]);
27
				   			
13
				   			
28
		if (isset($uid[1])) {
14
		if (isset($uid[1]) && $this->estUneSuiteIdentifiantsObservation($uid[1])) {
29
	           	$query="UPDATE cel_inventory " .
15
	           	$requete_transmission = 'UPDATE cel_inventory '.
Line 30... Line 16...
30
	           	"SET transmission = '".$DB->escapeSimple($pairs['transmission'])."',".
16
	           	'SET transmission = '.$pairs['transmission'].','.
Line 31... Line 17...
31
				"date_modification = now(), date_transmission = now() ". 
17
				'date_modification = now(), date_transmission = now() '. 
32
	        	"WHERE identifiant='".$DB->escapeSimple($uid[0])."' AND ordre in (".$DB->escapeSimple($uid[1]) .")";
18
	        	'WHERE identifiant='.$this->proteger($uid[0]).' AND ordre in ('.$uid[1].')';
33
		} 
19
		} 
Line 34... Line 20...
34
 
20
 
-
 
21
    	$resultat_transmission = $this->executerRequeteSimple($requete_transmission);
-
 
22
                
-
 
23
        if (!$resultat_transmission) {
-
 
24
        	return false;
-
 
25
        }
-
 
26
        
-
 
27
        return true;               
-
 
28
	}
-
 
29
	
35
    	$res =& $DB->query($query);
30
	private function estUneSuiteIdentifiantsObservation($chaine) {
36
                
31
		
37
        if (PEAR::isError($res)) {
-
 
38
        	die($res->getMessage());
-
 
Line 39... Line 32...
39
        }
32
		// un ensemble d'identifiants est une suite d'identifiants séparés par des virgules
Line 40... Line 33...
40
        
33
		// sans virgule terminale
41
        return true;
34
		$reg_exp = "/^(([0-9])+,)*([0-9])+$/";