Contact are profiles, not users.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 4 Mar 2010 20:39:56 +0000 (21:39 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 4 Mar 2010 20:39:56 +0000 (21:39 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/user.php
classes/userfilter.php
templates/emails/send.tpl

index 956f188..9936c94 100644 (file)
@@ -478,19 +478,19 @@ class User extends PlUser
     public function iterContacts()
     {
         $this->fetchContacts();
-        return self::iterOverUIDs(array_keys($this->contacts));
+        return Profile::iterOverPIDs(array_keys($this->contacts));
     }
 
     public function getContacts()
     {
         $this->fetchContacts();
-        return self::getBulkUsersWithUIDs(array_keys($this->contacts));
+        return Profile::getBulkProfilesWithPIDs(array_keys($this->contacts));
     }
 
-    public function isContact(PlUser &$user)
+    public function isContact(Profile &$profile)
     {
         $this->fetchContacts();
-        return isset($this->contacts[$user->id()]);
+        return isset($this->contacts[$profile->id()]);
     }
 
     // Groupes X
index a397945..474c3fc 100644 (file)
@@ -2509,9 +2509,9 @@ class UserFilter extends PlFilter
         $joins = array();
         foreach ($this->cts as $sub=>$key) {
             if (is_null($key)) {
-                $joins['c' . $sub] = new PlSqlJoin(PlSqlJoin::MODE_LEFT, 'contacts', '$ME.contact = $UID');
+                $joins['c' . $sub] = new PlSqlJoin(PlSqlJoin::MODE_LEFT, 'contacts', '$ME.contact = $PID');
             } else {
-                $joins['c' . $sub] = new PlSqlJoin(PlSqlJoin::MODE_LEFT, 'contacts', XDB::format('$ME.uid = {?} AND $ME.contact = $UID', substr($key, 5)));
+                $joins['c' . $sub] = new PlSqlJoin(PlSqlJoin::MODE_LEFT, 'contacts', XDB::format('$ME.uid = {?} AND $ME.contact = $PID', substr($key, 5)));
             }
         }
         return $joins;
index 4e9b0d3..fdc69bb 100644 (file)
         <div style="float: right; width: 40%;">
           <select id="to_contacts" name="to_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
           {foreach key=key item=contact from=$contacts}
-          {if in_array($contact->hruid,$smarty.request.to_contacts)}
-          <option value="{$contact->hruid}">
+          {if in_array($contact->hrpid,$smarty.request.to_contacts)}
+          <option value="{$contact->hrpid}">
             {$contact->full_name}
           </option>
           {/if}
           </select><br />
           <select id="cc_contacts" name="cc_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
           {foreach key=key item=contact from=$contacts}
-          {if in_array($contact->forlife,$smarty.request.cc_contacts)}
-          <option value="{$contact->forlife}">
+          {if in_array($contact->hrpid,$smarty.request.cc_contacts)}
+          <option value="{$contact->hrpid}">
             {$contact->full_name}
           </option>
           {/if}
         <div style="float: right; width: 40%">
           <select id="contacts" name="all_contacts[]" multiple="multiple" style="height: 10em; width: 100%">
             {foreach item=contact from=$contacts}
-            {if !in_array($contact->hruid,$smarty.request.to_contacts) && !in_array($contact->hruid,$smarty.request.cc_contacts)}
-            <option value="{$contact->hruid}">
+            {if !in_array($contact->hrpid,$smarty.request.to_contacts) && !in_array($contact->hrpid,$smarty.request.cc_contacts)}
+            <option value="{$contact->hrpid}">
               {$contact->full_name}
             </option>
             {/if}
           </select>
         </div>
         {foreach item=contact from=$contacts}
-        <input type="hidden" name="contacts[{$contact->hruid}]" value="{$contact->display_name} &lt;{$contact->forlife}&gt;" />
+        <input type="hidden" name="contacts[{$contact->hrpid}]" value="{$contact->display_name} &lt;{$contact->owner()->forlife}&gt;" />
         {/foreach}
       </td>
     </tr>