More 'plat/al-like' makeJs_hook for banana
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 4 Apr 2007 14:25:45 +0000 (14:25 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 4 Apr 2007 14:25:45 +0000 (14:25 +0000)
Use REPLACE instead of INSERT for adding new contacts. I don't know why, but the INSERT causes slave duplication errors

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1662 839d8a87-29fc-0310-9880-83ba4fa771e5

include/banana/hooks.inc.php
modules/carnet.php

index 68a51f4..82b3d66 100644 (file)
@@ -168,6 +168,13 @@ function hook_makeLink($params)
 }
 }
 
+function hook_makeJs($src)
+{
+    global $page;
+    $page->addJsLink("$src.js");
+    return ' ';
+}
+
 function get_banana_params(array &$get, $group = null, $action = null, $artid = null)
 {
     if (!is_null($group)) {
index c970213..1363f5c 100644 (file)
@@ -216,10 +216,10 @@ class CarnetModule extends PLModule
                 require_once('user.func.inc.php');
                 if (($login = get_user_login($user)) !== false) {
                     if (XDB::execute(
-                                'INSERT INTO  contacts (uid, contact)
-                                      SELECT  {?}, id
-                                        FROM  aliases
-                                       WHERE  alias = {?}', $uid, $login))
+                                'REPLACE INTO  contacts (uid, contact)
+                                       SELECT  {?}, id
+                                         FROM  aliases
+                                        WHERE  alias = {?}', $uid, $login))
                     {
                         $page->trig('Contact ajouté !');
                     } else {