import at.dockwork.utility.ToolsService
import at.dockwork.common.domain.IdentificationCode
import grails.util.Holders

class UpdateScriptService {

	def identificationCodeWriteService = Holders.grailsApplication.mainContext.getBean 'identificationCodeWriteService'

	def run(def connection, def dataSourceFields) {

		IdentificationCode.findAll().each{ identificationCode ->
		    identificationCode.code = ToolsService.trimLeadingString(identificationCode?.code ?: "", "0")
		    identificationCodeWriteService.save(identificationCode)
		}

		true
	}
}