Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 3758 Rev 3763
Line 52... Line 52...
52
	 * @var array
52
	 * @var array
53
	 */
53
	 */
54
	protected $parametres_autorises = array(
54
	protected $parametres_autorises = array(
55
		'-startDate' => array(false, '1', 'Date de début (parsée par strtotime). Ex: "YYYY:MM:DD HH:II:SS"'),
55
		'-startDate' => array(false, '1', 'Date de début (parsée par strtotime). Ex: "YYYY:MM:DD HH:II:SS"'),
56
		'-pnObsId' => array(false, true, "ID de l'obs chez PlantNet"),
56
		'-pnObsId' => array(false, true, "ID de l'obs chez PlantNet"),
-
 
57
		'-project' => array(false, true, "projectId de l'obs chez PlantNet"),
57
		'-tbObsId' => array(false, true, "ID de l'obs chez Tela"),
58
		'-tbObsId' => array(false, true, "ID de l'obs chez Tela"),
58
	);
59
	);
Line 59... Line 60...
59
 
60
 
60
	public function __construct($script_nom, $parametres_cli) {
61
	public function __construct($script_nom, $parametres_cli) {
Line 70... Line 71...
70
		switch ($cmd) {
71
		switch ($cmd) {
71
			case 'updateLatest':
72
			case 'updateLatest':
72
				$this->updateLatest($this->getParametre('startDate'));
73
				$this->updateLatest($this->getParametre('startDate'));
73
				break;
74
				break;
74
			case 'updateOnePN':
75
			case 'updateOnePN':
75
				$this->updateOne($this->getParametre('pnObsId'));
76
				$this->updateOnePN((int)$this->getParametre('pnObsId'), $this->getParametre('project'));
76
				break;
77
				break;
77
			case 'updateOneTB':
78
			case 'updateOneTB':
78
				$this->updateOneTB($this->getParametre('tbObsId'));
79
				$this->updateOneTB($this->getParametre('tbObsId'));
79
				break;
80
				break;
80
			case 'updateCorrespondingIdsTable':
81
			case 'updateCorrespondingIdsTable':
Line 82... Line 83...
82
				break;
83
				break;
83
			default:
84
			default:
84
				$msg = "Erreur : la commande '$cmd' n'existe pas!\n"
85
				$msg = "Erreur : la commande '$cmd' n'existe pas!\n"
85
						. ', utilisez plutôt :' . "\n"
86
						. ', utilisez plutôt :' . "\n"
86
						. 'php cli.php PullPlantnet -a updateLatest -startDate "YYYY:MM:DD HH:II:SS"' . "\n"
87
						. 'php cli.php PullPlantnet -a updateLatest -startDate "YYYY:MM:DD HH:II:SS"' . "\n"
87
						. 'php cli.php PullPlantnet -a updateOnePN -pnObsId "xxxxxx"' . "\n"
88
						. 'php cli.php PullPlantnet -a updateOnePN -pnObsId "xxxxxx" -project "xxxxxx"' . "\n"
88
						. 'php cli.php PullPlantnet -a updateOneTB -tbObsId "xxxxxx"' . "\n"
89
						. 'php cli.php PullPlantnet -a updateOneTB -tbObsId "xxxxxx"' . "\n"
89
						. 'php cli.php PullPlantnet -a updateCorrespondingIdsTable' . "\n"
90
						. 'php cli.php PullPlantnet -a updateCorrespondingIdsTable' . "\n"
90
						;
91
						;
91
				throw new Exception($msg);
92
				throw new Exception($msg);
92
		}
93
		}
Line 147... Line 148...
147
		$observations_PN = $responseJson['data'] ?? [];
148
		$observations_PN = $responseJson['data'] ?? [];
Line 148... Line 149...
148
 
149
 
149
		$this->hasMore = $responseJson['hasMore'];
150
		$this->hasMore = $responseJson['hasMore'];
150
		if ($this->hasMore) {
151
		if ($this->hasMore) {
151
			$this->count += count($observations_PN);
152
			$this->count += count($observations_PN);
152
			$this->currentPage = Config::get('urlPlantnetBase').$responseJson['next'].$this->count;
153
			$this->currentPage = Config::get('urlPlantnetBase').$responseJson['next'];
153
		} else {
154
		} else {
154
			$this->currentPage = '';
155
			$this->currentPage = '';
155
			$this->count = 0;
156
			$this->count = 0;
Line 218... Line 219...
218
				$email = $obs['author']['email'];
219
				$email = $obs['author']['email'];
219
				$infos_utilisateur = $this->findUserInfo($email);
220
				$infos_utilisateur = $this->findUserInfo($email);
220
				if (!$infos_utilisateur) {
221
				if (!$infos_utilisateur) {
221
					continue; // c'est pas un telabotaniste
222
					continue; // c'est pas un telabotaniste
222
				}
223
				}
223
				echo "Synchro d'une obs d'un telabotaniste : $email\n";
224
				//echo "Synchro d'une obs d'un telabotaniste : $email";
224
				// echo json_encode($obs);
225
				// echo json_encode($obs);
225
				// die(var_dump($obs));
226
				// die(var_dump($obs));
Line 226... Line 227...
226
 
227
 
227
				// vérification que l'obs n'a pas déjà été ajoutée à la BdD de Tela
228
				// vérification que l'obs n'a pas déjà été ajoutée à la BdD de Tela
Line 232... Line 233...
232
				if ($res) {
233
				if ($res) {
233
					// l'obs existe déjà, on vérifie si il faut màj puis on passe à la suite
234
					// l'obs existe déjà, on vérifie si il faut màj puis on passe à la suite
234
					// la date de l'obs est un microtime, donc on coupe les millièmes
235
					// la date de l'obs est un microtime, donc on coupe les millièmes
235
					// die(var_dump((int)($obs['dateUpdated']/1000), strtotime($res[0]['date_maj'])));
236
					// die(var_dump((int)($obs['dateUpdated']/1000), strtotime($res[0]['date_maj'])));
236
					if ((int)($obs['dateUpdated']/1000) > strtotime($res[0]['date_maj'])) {
237
					if ((int)($obs['dateUpdated']/1000) > strtotime($res[0]['date_maj'])) {
237
						echo "Obs déjà en base, mise à jour (TB {$res[0]['id_observation']})\n";
238
						echo "Obs déjà en base, mise à jour : ID PN {$obs['id']} ; ID TB {$res[0]['id_observation']} ; utilisateur_tb $email\n";
238
						$this->updateFromPN($obs, $res[0]['id_observation']);
239
						$this->updateFromPN($obs, $res[0]['id_observation']);
239
					} else {
240
					} else {
240
						echo "Obs déjà en base : ID PN {$obs['id']}, ID TB {$res[0]['id_observation']}\n";
241
						echo "Obs déjà en base, déjà à jour : ID PN {$obs['id']} ; ID TB {$res[0]['id_observation']} ; utilisateur_tb $email\n";
241
					}
242
					}
242
					continue;
243
					continue;
243
				}
244
				}
Line 244... Line 245...
244
 
245
 
Line 252... Line 253...
252
					if ($image['deleted']) {
253
					if ($image['deleted']) {
253
						continue;
254
						continue;
254
					}
255
					}
Line 255... Line 256...
255
 
256
 
-
 
257
					// téléchargement de l'image PN
-
 
258
					$img = false;
-
 
259
					$retry = 3;
-
 
260
					do {
-
 
261
						$img = file_get_contents($image['o']);
-
 
262
						$retry--;
-
 
263
					} while (!$img && $retry);
-
 
264
 
-
 
265
					if (!$img) {
-
 
266
						echo "Abandon, image impossible à télécharger : {$image['o']}\n";
-
 
267
						continue;
-
 
268
					}
-
 
269
 
256
					// téléchargement de l'image PN
270
					// Écriture dans un fichier temporaire
257
					$tempfile = tempnam("/tmp", "PullPN_") . ".jpg";
271
					$tempfile = tempnam("/tmp", "PullPN_") . ".jpg";
258
					$handle = fopen($tempfile, "w");
272
					$handle = fopen($tempfile, "w");
259
					fwrite($handle, file_get_contents($image['o']));
273
					fwrite($handle, $img);
Line 260... Line 274...
260
					fclose($handle);
274
					fclose($handle);
Line 261... Line 275...
261
 
275
 
262
					echo "cool on a fait un fichier de " . filesize($tempfile) . " octets là : $tempfile\n";
276
					echo "Image de " . number_format(filesize($tempfile), 0, ',', ' ') . " octets créé : $tempfile\n";
263
 
277
 
264
					$params = [
278
					$params = [
Line 295... Line 309...
295
					}
309
					}
296
				}
310
				}
297
				// var_dump($images, $tags_images);
311
				// var_dump($images, $tags_images);
298
				// die();
312
				// die();
Line -... Line 313...
-
 
313
 
-
 
314
				$geo = $this->getGeoInfo($obs['geo']);
299
 
315
 
300
				// on insère l'obs via le service CelWidgetSaisie
316
				// on insère l'obs via le service CelWidgetSaisie
301
				$infos_obs = [
-
 
302
					// 'obsId1[commune_code_insee]' => '',
-
 
303
					'obsId1[commune_nom]' => $obs['geo']['place'] ?? '',
317
				$infos_obs = [
304
					'obsId1[date]' => date('d/m/Y', intdiv($obs['dateObs'], 1000)),
318
					'obsId1[date]' => date('d/m/Y', intdiv($obs['dateObs'], 1000)),
305
					// 'obsId1[famille]' => '',
319
					'obsId1[latitude]' => $geo['lat'] ?? null,
-
 
320
					'obsId1[longitude]' => $geo['lon'] ?? null,
-
 
321
					'obsId1[pays]' => $geo['countryCode'] ?? null,
-
 
322
					'obsId1[code_postal]' => $geo['postcode'] ?? null,
-
 
323
					'obsId1[commune_nom]' => $geo['city'] ?? null,
306
					'obsId1[latitude]' => (string)$obs['geo']['lat'] ?? '',
324
					// 'obsId1[commune_code_insee]' => '',
307
					// 'obsId1[lieudit]' => '',
-
 
308
					'obsId1[longitude]' => (string)$obs['geo']['lon'] ?? '',
325
					// 'obsId1[lieudit]' => '',
309
					// 'obsId1[milieu]' => '',
-
 
310
					// 'obsId1[nom_ret]' => '',
326
					// 'obsId1[milieu]' => '',
-
 
327
					'obsId1[nom_sel]' => $obs['currentName'],
-
 
328
					// 'obsId1[nom_ret]' => '',
311
					'obsId1[nom_sel]' => $obs['currentName'],
329
					// 'obsId1[famille]' => '',
312
					'obsId1[certitude]' => 'douteux',
330
					'obsId1[certitude]' => 'douteux',
313
					// 'obsId1[notes]' => '',
331
					// 'obsId1[notes]' => '',
314
					// 'obsId1[num_nom_ret]' => '',
332
					// 'obsId1[num_nom_ret]' => '',
315
					// 'obsId1[num_nom_sel]' => '',
333
					// 'obsId1[num_nom_sel]' => '',
Line 328... Line 346...
328
				];
346
				];
Line 329... Line 347...
329
 
347
 
330
				foreach ($images as $i => $image) {
348
				foreach ($images as $i => $image) {
331
					$infos_obs["obsId1[image_nom][$i]"] = $image;
349
					$infos_obs["obsId1[image_nom][$i]"] = $image;
332
				}
350
				}
Line 333... Line 351...
333
				// die(var_dump($infos_obs));
351
				// var_dump($infos_obs);
334
 
352
 
335
				// curl post $infos_obs
353
				// curl post $infos_obs
336
				$ch = curl_init($url_cel_widget_saisie);
354
				$ch = curl_init($url_cel_widget_saisie);
Line 344... Line 362...
344
				if (!$reponse || 200 != $code) {
362
				if (!$reponse || 200 != $code) {
345
					throw new Exception("Ça a pété à l'envoi de l'obs :\n $reponse\n avec l'obs : " . json_encode($infos_obs) . "\n");
363
					throw new Exception("Ça a pété à l'envoi de l'obs :\n $reponse\n avec l'obs : " . json_encode($infos_obs) . "\n");
346
				}
364
				}
Line 347... Line 365...
347
 
365
 
348
				// var_dump($reponse);
366
				// var_dump($reponse);
349
				$id_obs_tb = $this->bdd->proteger(json_decode($reponse, true)['id']);
367
				$id_obs_tb = json_decode($reponse, true)['id'];
350
				$id_obs_pn = $this->bdd->proteger($obs['id']);
368
				$id_obs_pn = $obs['id'];
351
				// on insère les ids de correspondance obsPN obsTB dans la table cel_plantnet
369
				// on insère les ids de correspondance obsPN obsTB dans la table cel_plantnet
352
				$sql = 'INSERT INTO cel_plantnet (id_observation, id_plantnet, date_maj)'
370
				$sql = 'INSERT INTO cel_plantnet (id_observation, id_plantnet, date_maj)'
353
						.' VALUES (%s, %s, NOW())'
371
						.' VALUES (%s, %s, NOW())'
354
						. ' -- ' . __FILE__ . ':' . __LINE__;
372
						. ' -- ' . __FILE__ . ':' . __LINE__;
355
				$sql = sprintf($sql, $id_obs_tb, $id_obs_pn);
373
				$sql = sprintf($sql, $this->bdd->proteger($id_obs_tb), $this->bdd->proteger($id_obs_pn));
-
 
374
				$this->bdd->requeter($sql);
-
 
375
 
356
				$this->bdd->requeter($sql);
376
				echo "Obs insérée en base : ID PN $id_obs_pn ; ID TB $id_obs_tb ; utilisateur_tb $email\n";
357
			}
377
			}
358
		}
378
		}
Line 359... Line 379...
359
	}
379
	}
Line 449... Line 469...
449
		}
469
		}
Line 450... Line 470...
450
 
470
 
451
		return $infosUtilisateur;
471
		return $infosUtilisateur;
Line -... Line 472...
-
 
472
	}
-
 
473
 
-
 
474
	private function getGeoInfo($obs) {
-
 
475
		$geo = [];
-
 
476
		if (!isset($obs['lat']) && !isset($obs['lon'])) {
-
 
477
			return $geo;
-
 
478
		}
-
 
479
 
-
 
480
		// $data = [
-
 
481
		// 	'hitsPerPage' => 1,
-
 
482
		// 	'aroundLatLng' => "{$obs['lat']},{$obs['lon']}"
-
 
483
		// ];
-
 
484
		$headers = [
-
 
485
			'X-Algolia-Application-Id' => Config::get('algoliaApplicationId'),
-
 
486
			'X-Algolia-API-Key' => Config::get('algoliaAPIKey'),
-
 
487
		];
-
 
488
 
-
 
489
		$lat = number_format($obs['lat'], 6, '.', '');
-
 
490
		$lon = number_format($obs['lon'], 6, '.', '');
-
 
491
 
-
 
492
		$ch = curl_init(Config::get('urlReverseGeocodingLatLng')."$lat,$lon");
-
 
493
		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
-
 
494
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-
 
495
		$reponse = curl_exec($ch);
-
 
496
		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-
 
497
		curl_close($ch);
-
 
498
 
-
 
499
		if ($reponse) {
-
 
500
			$reponse = json_decode($reponse, true);
-
 
501
			// die(var_dump($reponse));
-
 
502
			$infos = $reponse['hits'][0];
-
 
503
 
-
 
504
			$geo = [
-
 
505
				'lat' => (string) $obs['lat'],
-
 
506
				'lon' => (string) $obs['lon'],
-
 
507
				'country' => $infos['country']['fr'] ?? $infos['country']['default'],
-
 
508
				'city' => $infos['city']['default'][0] ?? null,
-
 
509
				'postcode' => $infos['postcode'][0] ?? null,
-
 
510
				'countryCode' => strtoupper($infos['country_code']),
-
 
511
			];
-
 
512
		}
-
 
513
 
-
 
514
		return $geo;
452
	}
515
	}
453
 
516
 
454
	private function updateFromPN(array $pnObs, string $tbObsId) {
517
	private function updateFromPN(array $pnObs, string $tbObsId) {
455
		if (!is_array($pnObs) || !is_string($tbObsId)) {
518
		if (!is_array($pnObs) || !is_string($tbObsId)) {
456
			// die(var_dump($pnObs, $tbObsId));
519
			// die(var_dump($pnObs, $tbObsId));
457
			throw new Exception("\nBad params types\n");
520
			throw new Exception("\nBad params types, give me an array and an integer plz\n");
Line -... Line 521...
-
 
521
		}
-
 
522
		// die(var_dump($pnObs));
-
 
523
 
-
 
524
		// log update date to cel_plantnet
-
 
525
		$sql = "UPDATE cel_plantnet SET date_maj = NOW() WHERE id_observation = $tbObsId"
458
		}
526
				. ' -- ' . __FILE__ . ':' . __LINE__;
459
		// die(var_dump($pnObs));
527
		$this->bdd->requeter($sql);
460
 
528
 
461
		// check for deleted
529
		// check for deleted
462
		if (isset($pnObs['deleted']) && (true === $pnObs['deleted'])) {
530
		if (isset($pnObs['deleted']) && (true === $pnObs['deleted'])) {
463
			// est-ce une obs issue de PN ?
531
			// est-ce une obs issue de PN ?
464
			//// faut regarder le champ input_source == PlantNet
532
			//// faut regarder le champ input_source == PlantNet
465
			$sql = "SELECT input_source FROM occurrence WHERE id = '$tbObsId'"
-
 
-
 
533
			$sql = "SELECT input_source FROM occurrence WHERE id = '$tbObsId'"
466
					. ' -- ' . __FILE__ . ':' . __LINE__;
534
					. ' -- ' . __FILE__ . ':' . __LINE__;
467
			$res = $this->bdd->recupererTous($sql);
535
			$res = $this->bdd->recupererTous($sql);
468
			die(var_dump($res));
536
 
-
 
537
			if (isset($res[0]) && ('PlantNet' === $res[0]['input_source'])) {
469
			if (isset($res[0]) && ('PlantNet' === $res[0]['input_source'])) {
538
				// oui ? alors supprimer obs !
470
				// oui ? alors supprimer obs !
539
				echo "Obs supprimée coté PN, suppression : ID PN {$obs['id']} ; ID TB {$res[0]['id_observation']}\n";
471
				echo("obs à supprimer\n");
540
 
-
 
541
				$sql = "UPDATE photos SET occurrence_id = NULL WHERE occurrence_id = '$tbObsId'"
472
				$sql = "DELETE FROM occurrence WHERE id = '$tbObsId'"
542
						. ' -- ' . __FILE__ . ':' . __LINE__;
473
						. ' -- ' . __FILE__ . ':' . __LINE__;
543
				$this->bdd->requeter($sql);
474
				$this->bdd->requeter($sql);
544
 
475
				$sql = "UPDATE photos SET occurrence_id = NULL WHERE occurrence_id = '$tbObsId'"
545
				$sql = "DELETE FROM occurrence WHERE id = '$tbObsId'"
476
						. ' -- ' . __FILE__ . ':' . __LINE__;
546
						. ' -- ' . __FILE__ . ':' . __LINE__;
Line 507... Line 577...
507
 
577
 
508
		// // @TODO : compare votes
578
		// // @TODO : compare votes
509
		// // insert_new_votes($pn_sorted_votes, $existing_votes);
579
		// // insert_new_votes($pn_sorted_votes, $existing_votes);
Line 510... Line 580...
510
	}
580
	}
511
 
581
 
-
 
582
	private function updateOnePN($pnObsId, $pnProjectId) {
512
	private function updateOnePN($id) {
583
		if (!is_int($pnObsId) || !is_string($pnProjectId)) {
-
 
584
			die(var_dump($pnObsId, $pnProjectId));
-
 
585
			throw new Exception("\nBad params types, give me an integer and a string plz\n");
-
 
586
		}
-
 
587
		// get PN project list
-
 
588
		$list = [];
513
		// vérification que l'obs est bien dans la BdD de Tela
589
		$pnProjects = $this->getProjects(); // refresh projects list
-
 
590
		foreach ($pnProjects as $project) {
-
 
591
			$list[$project['id']] = $project['name'];
-
 
592
		}
514
		$sql = "SELECT date_maj, id_observation FROM cel_plantnet WHERE id_plantnet = '$id'"
593
 
515
					. ' -- ' . __FILE__ . ':' . __LINE__;
594
		// if project not in list display list
-
 
595
		if (!array_key_exists($pnProjectId, $list)) {
-
 
596
			echo "Available projects:\n";
516
		$res = $this->bdd->recupererTous($sql);
597
			foreach ($list as $projectId => $projectName) {
517
		// die(var_dump($res));
598
				echo " - $projectId ($projectName)\n";
-
 
599
			}
-
 
600
			throw new Exception("Project $pnProjectId does not exist\n");
-
 
601
		} else {
-
 
602
			$this->currentProject = [
-
 
603
				'id' => $pnProjectId,
518
		if (!$res) {
604
				'name' => $list[$pnProjectId],
Line 519... Line 605...
519
			throw new Exception("\nPlantnet occurrence id ($id) doesn't exist in tela db. \n");
605
			];
520
		}
606
		}
521
 
607
 
522
		// l'obs existe déjà à Tela, on vérifie si il faut màj
608
		// get PN obs
523
		$urlInfosObs = str_replace(
609
		$urlInfosObs = str_replace(
524
			['{token}', '{ids}'],
610
			['{token}', '{project}', '{id}'],
525
			[Config::get('tokenPlantnet'), $id],
611
			[Config::get('tokenPlantnet'), $pnProjectId, $pnObsId],
526
			Config::get('urlPlantnetBase').Config::get('urlPlantnetObsById')
612
			Config::get('urlPlantnetBase').Config::get('urlPlantnetObsById')
527
		);
613
		);
528
		$ch = curl_init($urlInfosObs);
614
		$ch = curl_init($urlInfosObs);
529
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
615
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Line 530... Line 616...
530
		$reponse = curl_exec($ch);
616
		$response = curl_exec($ch);
531
		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
617
		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
532
		curl_close($ch);
618
		curl_close($ch);
Line 533... Line 619...
533
 
619
 
534
		if (!$reponse || 200 != $code) {
620
		if (!$response || 200 != $code) {
-
 
621
			throw new Exception("\nPlantnet api ($urlInfosObs) replied with code $code : $response\n");
-
 
622
		}
-
 
623
 
-
 
624
		// change last modification date to force update
-
 
625
		$obs = json_decode($response, true);
-
 
626
		$date = new DateTime();
-
 
627
		$date->setTimestamp(intdiv($obs['dateUpdated'], 1000) - 1);
-
 
628
		$date = $this->bdd->proteger($date->format('Y-m-d H:i:s'));
535
			throw new Exception("\nPlantnet api ($urlInfosObs) replied with code $code : $reponse\n");
629
		$sql = "UPDATE cel_plantnet SET date_maj = $date WHERE id_plantnet = '$pnObsId'"
Line 536... Line 630...
536
		}
630
				. ' -- ' . __FILE__ . ':' . __LINE__;
537
 
631
		$this->bdd->requeter($sql);
538
		echo "La suite n'a pas été implémentée.\n";
632
 
Line 587... Line 681...
587
					. ' VALUES %s'
681
					. ' VALUES %s'
588
					. ' ON DUPLICATE KEY UPDATE id_observation=VALUES(id_observation), id_plantnet=VALUES(id_plantnet)'
682
					. ' ON DUPLICATE KEY UPDATE id_observation=VALUES(id_observation), id_plantnet=VALUES(id_plantnet)'
589
					. ' -- ' . __FILE__ . ':' . __LINE__;
683
					. ' -- ' . __FILE__ . ':' . __LINE__;
590
		$values = '';
684
		$values = '';
Line -... Line 685...
-
 
685
 
591
 
686
		echo "Updating matching partners ids table\n";
592
		foreach ($data as $id => $corres) {
687
		foreach ($data as $id => $corres) {
593
			$id_obs_tb = $this->bdd->proteger($corres['tb']);
688
			$id_obs_tb = $this->bdd->proteger($corres['tb']);
594
			$id_obs_pn = $this->bdd->proteger($corres['pn']);
689
			$id_obs_pn = $this->bdd->proteger($corres['pn']);
595
			// on insère les ids de correspondance obsPN obsTB dans la table cel_plantnet
690
			// on insère les ids de correspondance obsPN obsTB dans la table cel_plantnet
Line 607... Line 702...
607
		$values = substr($values, 0, -1); // retire la dernière virgule
702
		$values = substr($values, 0, -1); // retire la dernière virgule
608
		$sql = sprintf($sqlInsert, $values);
703
		$sql = sprintf($sqlInsert, $values);
609
		// var_dump($sql);
704
		// var_dump($sql);
610
		$this->bdd->requeter($sql);
705
		$this->bdd->requeter($sql);
Line -... Line 706...
-
 
706
 
-
 
707
		$count = count($data);
611
 
708
		echo "Success: #$count updated\n";
Line 612... Line 709...
612
	}
709
	}
613
 
710
 
614
	private function updateMatchingPartnersIds() {
711
	private function updateMatchingPartnersIds() {