Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 2338 | Rev 3018 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2338 Rev 2350
Línea 91... Línea 91...
91
        
91
        
92
        $record = $this->executeFetchOneArray($select);
92
        $record = $this->executeFetchOneArray($select);
93
        return $record['total'];
93
        return $record['total'];
Línea 94... Línea -...
94
    }
-
 
95
 
-
 
96
    public function fetchCountUnreadMessagesByConversationIdAndReceiverCompanyId($conversation_id, $receiver_company_id) 
-
 
97
    {
-
 
98
        $select = $this->sql->select(self::_TABLE);
-
 
99
        $select->columns(['total' => new Expression('COUNT(*)')]);
-
 
100
        $select->where->equalTo('conversation_id', $conversation_id);
-
 
101
        $select->where->equalTo('receiver_company_id', $receiver_company_id)
-
 
102
        ->and->equalTo('receiver_status', Message::STATUS_NORMAL)
-
 
103
        ->and->equalTo('read', Message::NO);
94
    }
104
        $select->limit(1);
-
 
105
        
-
 
106
        $record = $this->executeFetchOneArray($select);
-
 
Línea 107... Línea 95...
107
        return $record['total'];
95
 
108
    }
96
 
109
    
97
    
110
    /**
98
    /**
Línea 175... Línea 163...
175
            return $record['added_on'];
163
            return $record['added_on'];
176
        } 
164
        } 
Línea 177... Línea 165...
177
        
165
        
Línea 178... Línea -...
178
    }
-
 
179
 
-
 
180
    public function fetchLastMessagesByConversationIdAndReceiverCompanyId($conversation_id, $receiver_company_id)
-
 
181
    {
-
 
182
        $select = $this->sql->select(self::_TABLE);
-
 
183
        $select->columns(['added_on' => new Expression('MAX(added_on)')  ]);
-
 
184
        $select->where->equalTo('conversation_id', $conversation_id);
-
 
185
        $select->where->equalTo('receiver_company_id', $receiver_company_id)
-
 
186
        ->and->equalTo('receiver_status', Message::STATUS_NORMAL);
-
 
187
        $select->order('id desc');
-
 
188
        $select->limit(1);
-
 
189
        
166
    }
190
        //error_log($select->getSqlString($this->adapter->platform));
-
 
191
        
-
 
192
        $record = $this->executeFetchOneArray($select);
-
 
193
        if($record) {
-
 
194
            return $record['added_on'];
-
 
195
        } 
-
 
Línea 196... Línea 167...
196
        
167
 
197
    }
168
 
198
    
169
    
199
    /**
170
    /**