You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: journal_entry_items_controller.rb
    path of file: ./repos/ekylibre/app/controllers/backend
    
    the code of the file until where you have to start completion: # == License
# Ekylibre - Simple agricultural ERP
# Copyright (C) 2008-2011 Brice Texier, Thibaud Merigon
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FO
    
    def self.list_conditions
      code = ''
      code << search_conditions + ';'
      code << "if params[:tax_declaration_item_id]\n"
      code << "  c[0] += ' AND #{JournalEntryItem.table_name}.id IN (SELECT DISTINCT journal_entry_item_id FROM #{TaxDeclarationItemPart.table_name} WHERE tax_declaration_item_id = ?)'\n"
      code << "  c << params[:tax_declaration_item_id].to_i\n"
      code << "end\n"
      code << "if params[:account_id].to_i > 0\n"
      code << "  c[0] += ' AND account_id = ?'\n"
      code << "  c << params[:account_id].to_i\n"
      code << "end\n"
      code << "unless params[:period].blank? or params[:period]='all'\n"
      code << "  c[0] += ' AND id IN (SELECT account_id FROM #{JournalEntryItem.table_name} AS jel JOIN #{JournalEntry.table_name} AS je ON (entry_id=je.id) WHERE '+JournalEntry.period_condition(params[:period], params[:started_on], params[:stopped_on], 'je')+')'\n"
      code << "end\n"
      code << "c\n"
      code.c
    end