Ejemplo n.º 1
0
    /**
     * Get one last Document's note
     * @param $docid
     * @return array
     */
    public static function getLastNoteById($docid)
    {

        $note = new Notes();
        $condition = new CDbCriteria();
        $condition->condition = "Client_ID='" . Yii::app()->user->clientID . "'";
        $condition->addCondition("Document_ID = '" . $docid . "'");
        $condition->addCondition("Company_ID='0'");
        $condition->order = "Created DESC";
        $ap_note = $note->find($condition);

        if ($ap_note) {
            $comment = $ap_note->Comment;

        } else {
            $comment = '';
        }


        return $comment;
    }
Ejemplo n.º 2
0
    /**
     * Get last AP's notes
     * @param $apList
     * @return array
     */
    public static function getAPsNotes($apList)
    {
        $notes = array();
        foreach($apList as $ap) {
            $note = new Notes();
            $condition = new CDbCriteria();
            $condition->condition = "Client_ID='" . Yii::app()->user->clientID . "'";
            $condition->addCondition("Document_ID = '" . $ap->Document_ID . "'");
            $condition->addCondition("Company_ID='0'");
            $condition->order = "Created DESC";
            $ap_note = $note->find($condition);

            if ($ap_note) {
                $comment = $ap_note->Comment;
                $notes[$ap->AP_ID] = $comment;
            } else {
                $notes[$ap->AP_ID] = '';
            }
        }

        return $notes;
    }
Ejemplo n.º 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     $notes = Notes::find($id);
     $notes->delete();
     // redirect
     Session::flash('message', 'Successfully deleted the note!');
     return Redirect::to('notes');
 }