From 49dbfb38f6401e88381f4fd0686b20af9fe9de4e Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 20 Dec 2019 13:16:11 +0000 Subject: [PATCH] wait #3275 @1 --- inc/commons/class.common.ajax.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/inc/commons/class.common.ajax.php b/inc/commons/class.common.ajax.php index 18ccee259..d6ad60b37 100644 --- a/inc/commons/class.common.ajax.php +++ b/inc/commons/class.common.ajax.php @@ -551,6 +551,7 @@ Mot de passe : $password"; $maxRow = $sheet->getHighestRow(0); + $updated = 0; for ($i = 1; $i <= $maxRow; $i++) { $ref = trim($sheet->getCellByColumnAndRow(0, $i)); $url = trim($sheet->getCellByColumnAndRow(1, $i)->getOldCalculatedValue()); @@ -570,15 +571,24 @@ Mot de passe : $password"; $fref = self::_formatWsReferenceRef($ref, $_POST['type']); $furl = self::_formatWsReferenceUrl($url, $_POST['type']); - $delete = "DELETE FROM wsref WHERE ref='" . $core->con->escape($fref) . "' AND type='" . $core->con->escape($_POST['type']) . "'"; - $core->con->execute($delete); + try { + $delete = "DELETE FROM wsref WHERE ref='" . $core->con->escape($fref) . "' AND type='" . $core->con->escape($_POST['type']) . "'"; + $core->con->execute($delete); + } catch (Exception $e) { + } - $c = $core->con->openCursor('wsref'); - $c->type = $_POST['type']; - $c->ref = $fref; - $c->url = $furl; - $c->insert(); + try { + $c = $core->con->openCursor('wsref'); + $c->type = $_POST['type']; + $c->ref = $fref; + $c->url = $furl; + $c->insert(); + $updated++; + } catch (Exception $e) { + + } } + $x->addAlert(sprintf(__('%d liens insérés ou mis à jour'), $updated)); } public static function _formatWsReferenceRef($ref, $type) -- 2.39.5