Changeset 713

Show
Ignore:
Timestamp:
11/02/07 12:21:04 (1 year ago)
Author:
markku
Message:

Closes #479

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/controllers/customer_controller.rb

    r708 r713  
    4949               [_('Name'), :text_field, 'name', { :size => 30, :maxlength => 40 } ], 
    5050               [_('Description'), :text_field, 'description', { :size => 30, :maxlength => 60 } ], 
    51                [_('Email address'), :text_field, 'email', { :size => 30, :maxlength => 40 } ], 
     51               [_('Email address'), :text_field, 'email', { :size => 30, :maxlength => 40, :onchange => 'disable_notify_new_user()' } ], 
    5252               [_('Phone number'), :text_field, 'phone', { :size => 30, :maxlength => 20 } ], 
    5353               [_('City'), :text_field, 'city', { :size => 30, :maxlength => 40 } ], 
    5454               [_('Country'), :text_field, 'country', { :size => 30, :maxlength => 40 } ], 
    55                [_('Language'), :select, 'lang', @language_options] 
     55               [_('Language'), :select, 'lang', @language_options], 
     56               [_('Send email notification'), :check_box, 'notify_new_user'] 
    5657              ] 
    5758 
    58     common_create(Customer, 'login', {:action => 'list'}, {:action => 'list'}
     59    common_create(Customer, 'login', {:action => 'list'}, {:action => 'list'}, 'create'
    5960  end 
    6061 
  • trunk/app/controllers/customer_interface_controller.rb

    r712 r713  
    247247  # 
    248248  def comment_service_request 
    249     @task = Task.find(params[:id], :conditions => ['state != ?', Task.CLOSED]
     249    @task = Task.find(params[:id]
    250250    @title = _('Comment service request %s', @task.to_s) 
    251251 
    252     unless @assets.include?(@task.asset) and @task.task_type and @task.task_type.is_service_request_type 
     252    unless @assets.include?(@task.asset) and @task.task_type and @task.task_type.is_service_request_type and @task.state != Task.CLOSED 
    253253      flash[:error] = _('Service request %s not found!', @task.to_s) 
    254254      redirect_to(:action => 'index') 
  • trunk/app/models/customer.rb

    r712 r713  
    1313  belongs_to :service_request_type, :class_name => 'TaskType', :foreign_key => 'service_request_type_id' 
    1414  has_many :assets 
     15 
     16  event :created, :dispatch_after => :create 
    1517 
    1618  # Set the name as an alias for the full_name attribute: 
  • trunk/app/models/notification_mailer.rb

    r654 r713  
    1212  # Functions that the ModelObserver runs when corresponding events 
    1313  # for tasks take place 
     14 
     15  def self.customer_created(customer) 
     16    return unless customer.instance_of?(Customer) and customer.notify_new_user and customer.email and customer.email != '' 
     17    deliver_customer_created_notification(customer) 
     18  end 
    1419 
    1520  def self.task_created(task) 
     
    105110  end 
    106111 
     112  # Method: customer_created_notification 
     113  # ===================================== 
     114  # Sends an email notification to a new customer. 
     115  # 
     116  # Parameter: 
     117  # --------- 
     118  # customer - A <Customer> to whom the email is sent 
     119  # 
     120  def customer_created_notification(customer) 
     121    url = url_for(:host => ApplicationController.host, :controller => 'user', :action => 'login') 
     122 
     123    recipients "#{customer.name} <#{customer.email}>" 
     124    subject    localize('NorfelloCMMS - Customer account') 
     125    from       NotificationMailer.email_sender 
     126    sent_on    Time.now 
     127    body       :message => localize("Welcome to using NorfelloCMMS Customer interface.\nYou can login at %s.\n\nYour user account details are:\nUsername: %s\nPassword: %s\nEmail: %s\n\nWe recommend you to change the password when you login for the first time.", url, customer.login, customer.plain_password, customer.email), :automatic_message => localize("This is an automatic email notification from the NorfelloCMMS OS\nrunning at %s.", ApplicationController.host) 
     128 
     129    NotificationMailer._info("Mail generated for new customer '#{customer.login}'") 
     130  end 
     131 
    107132  private 
    108133  def localize(msg, *args) 
  • trunk/app/models/user.rb

    r707 r713  
    33 
    44class User < UserAccount 
    5   # Protection 
    6   attr_protected :full_name  # this name is NOT used by this model 
     5  # Protection (these fields are NOT used by this model) 
     6  attr_protected :full_name, :notify_new_user 
    77  # Validation 
    88  validates_presence_of :first_name, :last_name 
  • trunk/app/models/user_account.rb

    r708 r713  
    3131  validates_length_of :city, :maximum => 40 
    3232  # Callbacks 
     33  before_create :save_plain_password 
    3334  before_create :crypt_password 
    3435  before_validation_on_update :conserve_password_if_nil 
     
    4445 
    4546  cattr_accessor :current_user 
     47 
     48  # Plain (i.e. not encrypted) password can be read after creation if 
     49  # the notify_new_user attribute is set to true. Practise extra caution 
     50  # when using the plain_password attribute. 
     51  attr_reader :notify_new_user 
     52  attr_reader :plain_password 
     53 
     54  # Method: notify_new_user 
     55  # ======================= 
     56  # Sets the notify_new_user attribute. 
     57  # 
     58  def notify_new_user=(value) 
     59    if value == '1' or value == true 
     60      @notify_new_user = true 
     61    end 
     62  end 
    4663 
    4764  # Updates accessed_at timestamp for +user+, without updating updated_at timestamp. 
     
    196213    end 
    197214  end 
     215 
     216  # Method: save_plain_password 
     217  # =========================== 
     218  # Saves the password for later use if the notify_new_user attribute is true. 
     219  # 
     220  def save_plain_password 
     221    @plain_password = self.password if @notify_new_user 
     222    true 
     223  end 
    198224end 
  • trunk/doc/manual/latex/tex/configuration_section.tex

    r707 r713  
    317317You can edit a customer by using the 'Edit' action in 'Actions' column of the customer list. This action can also be used to view all information for a customer and to reset the password. 
    318318\paragraph{Create} 
    319 You can create a new customer by using the 'Create' function. Fill out the form and push the 'Create' button to submit the information. 
     319You can create a new customer by using the 'Create' function. Fill out the form and push the 'Create' button to submit the information. By choosing the 'Send email notification' option you can automatically email the customer account information to a new customer --- you'll have to fill the 'Email address' field for this to work. 
    320320\paragraph{Select service request type} 
    321321The \emph{service request type} is the task type that is used when a customer submits a service request through the 'Customer interface'. By using this action you can select a task type that is used to store the service requests.  The default database shipped with NorfelloCMMS OS contains an example service request type named 'Service request from a customer' which you can edit to match your needs in the 'Task types' menu. 
  • trunk/po/fi_FI/norfello_cmms.po

    r710 r713  
    22msgstr "" 
    33"Project-Id-Version: NorfelloCMMS SVN trunk\n" 
    4 "POT-Creation-Date: 2007-10-18 13:52+0300\n" 
    5 "PO-Revision-Date: 2007-10-18 14:05+0200\n" 
     4"POT-Creation-Date: 2007-11-02 11:48+0200\n" 
     5"PO-Revision-Date: 2007-11-02 12:12+0200\n" 
    66"Last-Translator: Markku Oksanen <markku.oksanen@norfello.com>\n" 
    77"Language-Team: Norfello Ltd. <contact@norfello.com>\n" 
     
    3434msgstr "ei saa olla aikaisempi kuin aloitusaika" 
    3535 
    36 #: app/models/task.rb:137 
     36#: app/models/task.rb:150 
    3737msgid "Task was assigned to you" 
    3838msgstr "Sinulle annettiin tehtÀvÀ" 
     
    113113 
    114114#: app/models/form_field.rb:41 
    115 #: app/controllers/customer_interface_controller.rb:44 
     115#: app/controllers/customer_interface_controller.rb:46 
    116116#: app/controllers/asset_field_controller.rb:113 
    117117msgid "Time" 
     
    291291 
    292292#: app/models/attachment_methods.rb:38 
    293 #: app/helpers/customer_interface_helper.rb:109 
    294 #: app/helpers/customer_interface_helper.rb:111 
    295 #: app/helpers/customer_interface_helper.rb:132 
    296 #: app/helpers/customer_interface_helper.rb:134 
    297 #: app/helpers/customer_interface_helper.rb:136 
    298 #: app/helpers/customer_interface_helper.rb:138 
    299 #: app/helpers/customer_interface_helper.rb:140 
    300 #: app/helpers/customer_interface_helper.rb:142 
    301 #: app/helpers/customer_interface_helper.rb:161 
    302 #: app/controllers/customer_interface_controller.rb:160 
     293#: app/helpers/customer_interface_helper.rb:141 
     294#: app/helpers/customer_interface_helper.rb:143 
     295#: app/helpers/customer_interface_helper.rb:164 
     296#: app/helpers/customer_interface_helper.rb:166 
     297#: app/helpers/customer_interface_helper.rb:168 
     298#: app/helpers/customer_interface_helper.rb:170 
     299#: app/helpers/customer_interface_helper.rb:172 
     300#: app/helpers/customer_interface_helper.rb:174 
     301#: app/helpers/customer_interface_helper.rb:193 
     302#: app/controllers/customer_interface_controller.rb:161 
    303303#: app/views/task/_display_task_event.rhtml:6 
    304304#: app/views/task/_display_task_event.rhtml:8 
     
    653653msgstr "cmmspohja" 
    654654 
    655 #: app/helpers/customer_interface_helper.rb:43 
     655#: app/helpers/customer_interface_helper.rb:71 
    656656#: app/helpers/application_helper.rb:428 
    657657#: app/controllers/form_controller.rb:461 
     
    659659msgstr "Lomake" 
    660660 
    661 #: app/helpers/customer_interface_helper.rb:64 
     661#: app/helpers/customer_interface_helper.rb:96 
    662662#: app/helpers/application_helper.rb:451 
    663663msgid "Task" 
    664664msgstr "TehtÀvÀ" 
    665665 
    666 #: app/helpers/customer_interface_helper.rb:89 
     666#: app/helpers/customer_interface_helper.rb:98 
     667#: app/controllers/customer_interface_controller.rb:250 
     668msgid "Comment service request %s" 
     669msgstr "Kommentoi palvelupyyntöÀ %s" 
     670 
     671#: app/helpers/customer_interface_helper.rb:121 
    667672#: app/helpers/application_helper.rb:470 
    668673#: app/controllers/attachment_controller.rb:22 
     
    672677msgstr "Liitetiedosto" 
    673678 
    674 #: app/helpers/customer_interface_helper.rb:109 
     679#: app/helpers/customer_interface_helper.rb:141 
    675680#: app/views/timeline/_display_event.rhtml:37 
    676681msgid "Filled out by %s" 
    677682msgstr "TÀytetty kÀyttÀjÀn %s toimesta" 
    678683 
    679 #: app/helpers/customer_interface_helper.rb:111 
     684#: app/helpers/customer_interface_helper.rb:143 
    680685#: app/views/timeline/_display_event.rhtml:39 
    681686msgid "Modified by %s" 
    682687msgstr "Muokattu kÀyttÀjÀn %s toimesta" 
    683688 
    684 #: app/helpers/customer_interface_helper.rb:132 
     689#: app/helpers/customer_interface_helper.rb:164 
    685690#: app/views/task/_display_task_event.rhtml:6 
    686691#: app/views/timeline/_display_event.rhtml:14 
     
    688693msgstr "Luotu kÀyttÀjÀn %s toimesta" 
    689694 
    690 #: app/helpers/customer_interface_helper.rb:134 
     695#: app/helpers/customer_interface_helper.rb:166 
    691696#: app/views/task/_display_task_event.rhtml:8 
    692697#: app/views/timeline/_display_event.rhtml:16 
     
    694699msgstr "Suljettu kÀyttÀjÀn %s toimesta" 
    695700 
    696 #: app/helpers/customer_interface_helper.rb:136 
     701#: app/helpers/customer_interface_helper.rb:168 
    697702#: app/views/timeline/_display_event.rhtml:18 
    698703msgid "Assigned to %s by %s" 
    699704msgstr "%s asetettu vastuulliseksi kÀyttÀjÀn %s toimesta" 
    700705 
    701 #: app/helpers/customer_interface_helper.rb:138 
     706#: app/helpers/customer_interface_helper.rb:170 
    702707#: app/views/task/_display_task_event.rhtml:12 
    703708#: app/views/timeline/_display_event.rhtml:20 
     
    705710msgstr "HyvÀksytty kÀyttÀjÀn %s toimesta" 
    706711 
    707 #: app/helpers/customer_interface_helper.rb:140 
     712#: app/helpers/customer_interface_helper.rb:172 
    708713#: app/views/task/_display_task_event.rhtml:14 
    709714#: app/views/timeline/_display_event.rhtml:22 
     
    711716msgstr "Avattu uudestaan kÀyttÀjÀn %s toimesta" 
    712717 
    713 #: app/helpers/customer_interface_helper.rb:142 
     718#: app/helpers/customer_interface_helper.rb:174 
    714719#: app/views/task/_display_task_event.rhtml:16 
    715720#: app/views/timeline/_display_event.rhtml:24 
     
    717722msgstr "Kommentti lisÀtty kÀyttÀjÀn %s toimesta" 
    718723 
    719 #: app/helpers/customer_interface_helper.rb:161 
     724#: app/helpers/customer_interface_helper.rb:193 
    720725#: app/views/timeline/_display_event.rhtml:52 
    721726msgid "Uploaded by %s" 
    722727msgstr "Tallennettu kÀyttÀjÀn %s toimesta" 
    723728 
    724 #: app/helpers/customer_interface_helper.rb:173 
     729#: app/helpers/customer_interface_helper.rb:205 
    725730#: app/controllers/task_controller.rb:452 
    726731#: app/controllers/overview_controller.rb:59 
     
    728733msgstr "Uusi" 
    729734 
    730 #: app/helpers/customer_interface_helper.rb:175 
     735#: app/helpers/customer_interface_helper.rb:207 
    731736#: app/controllers/task_controller.rb:452 
    732737#: app/controllers/overview_controller.rb:59 
     
    735740msgstr "Osoitettu työntekijÀlle" 
    736741 
    737 #: app/helpers/customer_interface_helper.rb:177 
     742#: app/helpers/customer_interface_helper.rb:209 
    738743#: app/controllers/task_controller.rb:452 
    739744#: app/controllers/overview_controller.rb:59 
     
    742747msgstr "HyvÀksytty" 
    743748 
    744 #: app/helpers/customer_interface_helper.rb:179 
     749#: app/helpers/customer_interface_helper.rb:211 
    745750#: app/controllers/task_controller.rb:452 
    746751#: app/controllers/overview_controller.rb:65 
     
    748753msgstr "Suljettu" 
    749754 
    750 #: app/helpers/customer_interface_helper.rb:191 
    751 #: app/views/customer_interface/_item_list.rhtml:48 
     755#: app/helpers/customer_interface_helper.rb:223 
     756#: app/views/customer_interface/_item_list.rhtml:50 
    752757#: lib/localization.rb:17 
    753758msgid "%Y-%m-%d" 
    754759msgstr "%d.%m.%Y" 
    755760 
    756 #: app/helpers/customer_interface_helper.rb:191 
    757 #: app/views/customer_interface/_item_list.rhtml:48 
     761#: app/helpers/customer_interface_helper.rb:223 
     762#: app/views/customer_interface/_item_list.rhtml:50 
    758763msgid "%H:%M" 
    759764msgstr "%H:%M" 
    760765 
    761 #: app/helpers/customer_interface_helper.rb:193 
     766#: app/helpers/customer_interface_helper.rb:225 
    762767msgid "by %s" 
    763768msgstr "%s toimesta" 
     
    927932 
    928933#: app/controllers/asset_controller.rb:61 
    929 #: app/controllers/customer_interface_controller.rb:45 
    930 #: app/controllers/customer_interface_controller.rb:163 
     934#: app/controllers/customer_interface_controller.rb:47 
     935#: app/controllers/customer_interface_controller.rb:164 
    931936#: app/controllers/form_controller.rb:460 
    932937#: app/controllers/task_controller.rb:42 
     
    939944#: app/views/task/_form.rhtml:51 
    940945#: app/views/form/view.rhtml:13 
     946#: app/views/customer_interface/comment_service_request.rhtml:4 
    941947#: app/views/notification_mailer/task_notification.rhtml:5 
    942948#: config/menu.rb:56 
     
    950956#: app/controllers/task_type_controller.rb:36 
    951957#: app/controllers/task_type_controller.rb:51 
     958#: app/controllers/customer_interface_controller.rb:210 
    952959#: app/controllers/user_group_controller.rb:21 
    953960#: app/controllers/user_group_controller.rb:39 
     
    959966#: app/controllers/customer_controller.rb:27 
    960967#: app/controllers/customer_controller.rb:49 
    961 #: app/controllers/customer_controller.rb:70 
     968#: app/controllers/customer_controller.rb:71 
    962969#: app/controllers/action_key_controller.rb:24 
    963970#: app/controllers/action_key_controller.rb:33 
     
    10401047#: app/controllers/task_type_controller.rb:37 
    10411048#: app/controllers/task_type_controller.rb:52 
    1042 #: app/controllers/customer_interface_controller.rb:164 
     1049#: app/controllers/customer_interface_controller.rb:165 
    10431050#: app/controllers/asset_type_controller.rb:45 
    10441051#: app/controllers/asset_type_controller.rb:55 
     
    10461053#: app/controllers/task_controller.rb:398 
    10471054#: app/controllers/customer_controller.rb:50 
    1048 #: app/controllers/customer_controller.rb:71 
     1055#: app/controllers/customer_controller.rb:72 
    10491056#: app/controllers/user_controller.rb:99 
    10501057#: app/controllers/user_controller.rb:111 
     
    12241231msgstr "YhtÀÀn tehtÀvÀpohjaa ei ole tallennettu palvelimelle." 
    12251232 
    1226 #: app/controllers/customer_interface_controller.rb:46 
     1233#: app/controllers/customer_interface_controller.rb:48 
    12271234msgid "Action" 
    12281235msgstr "Tapahtuma" 
    12291236 
    1230 #: app/controllers/customer_interface_controller.rb:108 
     1237#: app/controllers/customer_interface_controller.rb:110 
    12311238#: app/controllers/message_controller.rb:21 
    12321239#: app/views/message/send_message.rhtml:21 
     
    12351242msgstr "Aihe" 
    12361243 
    1237 #: app/controllers/customer_interface_controller.rb:109 
     1244#: app/controllers/customer_interface_controller.rb:111 
    12381245msgid "Status" 
    12391246msgstr "Tila" 
    12401247 
    1241 #: app/controllers/customer_interface_controller.rb:110 
     1248#: app/controllers/customer_interface_controller.rb:112 
    12421249msgid "Last updated" 
    12431250msgstr "Muokattu" 
    12441251 
    1245 #: app/controllers/customer_interface_controller.rb:156 
    1246 #: app/views/layouts/customer_interface.rhtml:57 
     1252#: app/controllers/customer_interface_controller.rb:158 
     1253#: app/views/layouts/customer_interface.rhtml:58 
    12471254msgid "Submit service request" 
    12481255msgstr "LÀhetÀ palvelupyyntö" 
    12491256 
    1250 #: app/controllers/customer_interface_controller.rb:162 
     1257#: app/controllers/customer_interface_controller.rb:163 
    12511258msgid "Summary" 
    12521259msgstr "Yhteenveto" 
    12531260 
    1254 #: app/controllers/customer_interface_controller.rb:185 
     1261#: app/controllers/customer_interface_controller.rb:186 
    12551262msgid "Service request %s successfully received" 
    12561263msgstr "Palvelupyyntö %s vastaanotettu" 
    12571264 
    1258 #: app/controllers/customer_interface_controller.rb:189 
     1265#: app/controllers/customer_interface_controller.rb:190 
    12591266msgid "Submitting" 
    12601267msgstr "LÀhetys" 
     1268 
     1269#: app/controllers/customer_interface_controller.rb:198 
     1270#: app/views/customer_interface/comment_service_request.rhtml:15 
     1271msgid "Submit" 
     1272msgstr "LÀhetÀ" 
     1273 
     1274#: app/controllers/customer_interface_controller.rb:206 
     1275#: app/controllers/user_controller.rb:313 
     1276#: app/views/layouts/customer_interface.rhtml:50 
     1277#: config/menu.rb:15 
     1278msgid "My information" 
     1279msgstr "Omat tiedot" 
     1280 
     1281#: app/controllers/customer_interface_controller.rb:211 
     1282#: app/controllers/customer_controller.rb:28 
     1283#: app/controllers/customer_controller.rb:46 
     1284#: app/controllers/user_controller.rb:28 
     1285#: app/controllers/user_controller.rb:48 
     1286#: app/controllers/user_controller.rb:280 
     1287#: app/controllers/user_controller.rb:317 
     1288#: app/views/user/view.rhtml:6 
     1289#: app/views/user/search.rhtml:4 
     1290#: app/views/user/login.rhtml:34 
     1291msgid "Username" 
     1292msgstr "KÀyttÀjÀnimi" 
     1293 
     1294#: app/controllers/customer_interface_controller.rb:212 
     1295#: app/controllers/customer_controller.rb:51 
     1296#: app/controllers/customer_controller.rb:73 
     1297#: app/controllers/user_controller.rb:54 
     1298#: app/controllers/user_controller.rb:86 
     1299#: app/controllers/user_controller.rb:319 
     1300#: app/views/user/view.rhtml:18 
     1301msgid "Email address" 
     1302msgstr "SÀhköpostiosoite" 
     1303 
     1304#: app/controllers/customer_interface_controller.rb:213 
     1305#: app/controllers/customer_controller.rb:52 
     1306#: app/controllers/customer_controller.rb:74 
     1307#: app/controllers/user_controller.rb:55 
     1308#: app/controllers/user_controller.rb:87 
     1309#: app/controllers/user_controller.rb:320 
     1310#: app/views/user/view.rhtml:22 
     1311msgid "Phone number" 
     1312msgstr "Puhelinnumero" 
     1313 
     1314#: app/controllers/customer_interface_controller.rb:214 
     1315#: app/controllers/customer_controller.rb:53 
     1316#: app/controllers/customer_controller.rb:75 
     1317#: app/controllers/user_controller.rb:57 
     1318#: app/controllers/user_controller.rb:89 
     1319#: app/controllers/user_controller.rb:322 
     1320#: app/views/user/view.rhtml:30 
     1321msgid "City" 
     1322msgstr "Kaupunki" 
     1323 
     1324#: app/controllers/customer_interface_controller.rb:215 
     1325#: app/controllers/customer_controller.rb:54 
     1326#: app/controllers/customer_controller.rb:76 
     1327#: app/controllers/user_controller.rb:58 
     1328#: app/controllers/user_controller.rb:90 
     1329#: app/controllers/user_controller.rb:323 
     1330#: app/views/user/view.rhtml:34 
     1331msgid "Country" 
     1332msgstr "Maa" 
     1333 
     1334#: app/controllers/customer_interface_controller.rb:216 
     1335#: app/controllers/customer_controller.rb:55 
     1336#: app/controllers/customer_controller.rb:77 
     1337#: app/controllers/user_controller.rb:93 
     1338#: app/controllers/user_controller.rb:326 
     1339msgid "Language" 
     1340msgstr "Kieli" 
     1341 
     1342#: app/controllers/customer_interface_controller.rb:228 
     1343#: app/controllers/user_controller.rb:343 
     1344msgid "Your information has been updated" 
     1345msgstr "Tiedot pÀivitetty" 
     1346 
     1347#: app/controllers/customer_interface_controller.rb:231 
     1348#: app/controllers/user_controller.rb:345 
     1349msgid "Unable to update your information" 
     1350msgstr "Tietojen pÀivittÀminen epÀonnistui" 
     1351 
     1352#: app/controllers/customer_interface_controller.rb:253 
     1353msgid "Service request %s not found!" 
     1354msgstr "PalvelupyyntöÀ %s ei löydy!" 
     1355 
     1356#: app/controllers/customer_interface_controller.rb:261 
     1357msgid "Comment successfully received" 
     1358msgstr "Kommentti vastaanotettu" 
     1359 
     1360#: app/controllers/customer_interface_controller.rb:267 
     1361msgid "Comment can't be empty. Please provide one." 
     1362msgstr "Kommentti ei voi olla tyhjÀ. Ole hyvÀ ja tÀytÀ se." 
    12611363 
    12621364#: app/controllers/application.rb:53 
     
    12951397msgstr "Salasana vaihdettu" 
    12961398 
    1297 #: app/controllers/application.rb:437 
     1399#: app/controllers/application.rb:438 
    12981400msgid "Unable to reset password" 
    12991401msgstr "Salasanan vaihtaminen epÀonnistui" 
     1402 
     1403#: app/controllers/application.rb:459 
     1404#: app/views/customer_interface/_edit_my_information.rhtml:1 
     1405#: app/views/customer_interface/edit_my_information.rhtml:1 
     1406#: config/menu.rb:16 
     1407msgid "Change password" 
     1408msgstr "Vaihda salasana" 
     1409 
     1410#: app/controllers/application.rb:467 
     1411msgid "Your password has been changed" 
     1412msgstr "Salasana vaihdettu" 
     1413 
     1414#: app/controllers/application.rb:471 
     1415msgid "Unable to change your password" 
     1416msgstr "Salasanan vaihtaminen epÀonnistui" 
     1417 
     1418#: app/controllers/application.rb:474 
     1419msgid "Invalid password" 
     1420msgstr "VÀÀrÀ salasana" 
    13001421 
    13011422#: app/controllers/data_permission_controller.rb:25 
     
    16961817 
    16971818#: app/controllers/task_controller.rb:215 
    1698 #: app/controllers/customer_controller.rb:118 
     1819#: app/controllers/customer_controller.rb:119 
    16991820msgid "No task types defined." 
    17001821msgstr "YhtÀÀn tehtÀvÀtyyppiÀ ei ole mÀÀritelty." 
     
    18301951msgstr "Asiakkaat" 
    18311952 
    1832 #: app/controllers/customer_controller.rb:28 
    1833 #: app/controllers/customer_controller.rb:46 
    1834 #: app/controllers/user_controller.rb:28 
    1835 #: app/controllers/user_controller.rb:48 
    1836 #: app/controllers/user_controller.rb:280 
    1837 #: app/controllers/user_controller.rb:317 
    1838 #: app/views/user/view.rhtml:6 
    1839 #: app/views/user/search.rhtml:4 
    1840 #: app/views/user/login.rhtml:34 
    1841 msgid "Username" 
    1842 msgstr "KÀyttÀjÀnimi" 
    1843  
    18441953#: app/controllers/customer_controller.rb:29 
    18451954msgid "Assets" 
     
    18611970msgstr "Varmista salasana" 
    18621971 
    1863 #: app/controllers/customer_controller.rb:51 
    1864 #: app/controllers/customer_controller.rb:72 
    1865 #: app/controllers/user_controller.rb:54 
    1866 #: app/controllers/user_controller.rb:86 
    1867 #: app/controllers/user_controller.rb:319 
    1868 #: app/views/user/view.rhtml:18 
    1869 msgid "Email address" 
    1870 msgstr "SÀhköpostiosoite" 
    1871  
    1872 #: app/controllers/customer_controller.rb:52 
    1873 #: app/controllers/customer_controller.rb:73 
    1874 #: app/controllers/user_controller.rb:55 
    1875 #: app/controllers/user_controller.rb:87 
    1876 #: app/controllers/user_controller.rb:320 
    1877 #: app/views/user/view.rhtml:22 
    1878 msgid "Phone number" 
    1879 msgstr "Puhelinnumero" 
    1880  
    1881 #: app/controllers/customer_controller.rb:53 
    1882 #: app/controllers/customer_controller.rb:74 
    1883 #: app/controllers/user_controller.rb:57 
    1884 #: app/controllers/user_controller.rb:89 
    1885 #: app/controllers/user_controller.rb:322 
    1886 #: app/views/user/view.rhtml:30 
    1887 msgid "City" 
    1888 msgstr "Kaupunki" 
    1889  
    1890 #: app/controllers/customer_controller.rb:54 
    1891 #: app/controllers/customer_controller.rb:75 
    1892 #: app/controllers/user_controller.rb:58 
    1893 #: app/controllers/user_controller.rb:90 
    1894 #: app/controllers/user_controller.rb:323 
    1895 #: app/views/user/view.rhtml:34 
    1896 msgid "Country" 
    1897 msgstr "Maa" 
    1898  
    1899 #: app/controllers/customer_controller.rb:55 
    1900 #: app/controllers/customer_controller.rb:76 
    1901 #: app/controllers/user_controller.rb:93 
    1902 #: app/controllers/user_controller.rb:326 
    1903 msgid "Language" 
    1904 msgstr "Kieli" 
    1905  
    1906 #: app/controllers/customer_controller.rb:67 
     1972#: app/controllers/customer_controller.rb:56 
     1973msgid "Send email notification" 
     1974msgstr "LÀhetÀ sÀhköposti-ilmoitus" 
     1975 
     1976#: app/controllers/customer_controller.rb:68 
    19071977msgid "Edit customer: %s" 
    19081978msgstr "Muokkaa asiakasta: %s" 
    19091979 
    1910 #: app/controllers/customer_controller.rb:88 
     1980#: app/controllers/customer_controller.rb:89 
    19111981msgid "Customer information" 
    19121982msgstr "Asiakkaan tiedot" 
    19131983 
    1914 #: app/controllers/customer_controller.rb:112 
     1984#: app/controllers/customer_controller.rb:113 
    19151985msgid "Select a type for service requests" 
    19161986msgstr "Valitse palvelupyyntöjen tyyppi" 
     
    21422212msgstr "KÀyttÀjÀn %s tiedot" 
    21432213 
    2144 #: app/controllers/user_controller.rb:313 
    2145 #: config/menu.rb:15 
    2146 msgid "My information" 
    2147 msgstr "Omat tiedot" 
    2148  
    21492214#: app/controllers/user_controller.rb:324 
    21502215msgid "Send notification when I'm assigned to task as responsible user" 
     
    21542219msgid "Send notification when I'm assigned to task as worker" 
    21552220msgstr "LÀhteÀ ilmoitus kun minut mÀrÀtÀÀn työntekijÀksi tehtÀvÀÀn" 
    2156  
    2157 #: app/controllers/user_controller.rb:343 
    2158 msgid "Your information has been updated" 
    2159 msgstr "Tiedot pÀivitetty" 
    2160  
    2161 #: app/controllers/user_controller.rb:345 
    2162 msgid "Unable to update your information" 
    2163 msgstr "Tietojen pÀivittÀminen epÀonnistui" 
    2164  
    2165 #: app/controllers/user_controller.rb:354 
    2166 #: config/menu.rb:16 
    2167 msgid "Change password" 
    2168 msgstr "Vaihda salasana" 
    2169  
    2170 #: app/controllers/user_controller.rb:362 
    2171 msgid "Your password has been changed" 
    2172 msgstr "Salasana vaihdettu" 
    2173  
    2174 #: app/controllers/user_controller.rb:365 
    2175 msgid "Unable to change your password" 
    2176 msgstr "Salasanan vaihtaminen epÀonnistui" 
    2177  
    2178 #: app/controllers/user_controller.rb:368 
    2179 msgid "Invalid password" 
    2180 msgstr "VÀÀrÀ salasana" 
    21812221 
    21822222#: app/controllers/form_type_controller.rb:19 
     
    30783118 
    30793119#: app/views/shared/reset_password.rhtml:6 
    3080 #: app/views/user/change_password.rhtml:10 
     3120#: app/views/shared/change_password.rhtml:10 
    30813121msgid "New password" 
    30823122msgstr "Uusi salasana" 
    30833123 
    30843124#: app/views/shared/reset_password.rhtml:10 
    3085 #: app/views/user/change_password.rhtml:14 
     3125#: app/views/shared/change_password.rhtml:14 
    30863126msgid "New password confirmation" 
    30873127msgstr "Uuden salasanan varmistus" 
     
    31023142msgid "Reset password" 
    31033143msgstr "Nollaa salasana" 
     3144 
     3145#: app/views/shared/change_password.rhtml:6 
     3146msgid "Old password" 
     3147msgstr "Vanha salasana" 
     3148 
     3149#: app/views/shared/change_password.rhtml:18 
     3150msgid "Change" 
     3151msgstr "Vaihda" 
    31043152 
    31053153#: app/views/shared/_list_items.rhtml:168 
     
    31153163 
    31163164#: app/views/shared/_list_items.rhtml:196 
    3117 #, fuzzy 
    31183165msgid "Export list:" 
    3119 msgstr "Raporttilista
     3166msgstr "Vie lista:
    31203167 
    31213168#: app/views/shared/_list_items.rhtml:197 
     
    31373184#: app/views/shared/_list_items.rhtml:311 
    31383185#: app/views/shared/export_items_csv.rhtml:37 
    3139 #: app/views/customer_interface/_item_list.rhtml:62 
     3186#: app/views/customer_interface/_item_list.rhtml:64 
    31403187msgid "No" 
    31413188msgstr "Ei" 
     
    31443191#: app/views/shared/export_items_csv.rhtml:39 
    31453192#: app/views/form/remove.rhtml:5 
    3146 #: app/views/customer_interface/_item_list.rhtml:64 
     3193#: app/views/customer_interface/_item_list.rhtml:66 
    31473194msgid "Yes" 
    31483195msgstr "KyllÀ" 
     
    31693216msgstr "Kirjaudu sisÀÀn" 
    31703217 
    3171 #: app/views/user/change_password.rhtml:6 
    3172 msgid "Old password" 
    3173 msgstr "Vanha salasana" 
    3174  
    3175 #: app/views/user/change_password.rhtml:18 
    3176 msgid "Change" 
    3177 msgstr "Vaihda" 
    3178  
    31793218#: app/views/user/edit.rhtml:1 
    31803219msgid "User information" 
     
    32143253 
    32153254#: app/views/layouts/mainlevel.rhtml:86 
    3216 #: app/views/layouts/customer_interface.rhtml:49 
     3255#: app/views/layouts/customer_interface.rhtml:50 
    32173256msgid "Logged in as" 
    32183257msgstr "Kirjauduttu tunnuksella" 
     
    33203359msgstr "TÀytÀ kuvakenttÀ" 
    33213360 
     3361#: app/views/customer_interface/comment_service_request.rhtml:7 
     3362msgid "Message" 
     3363msgstr "Viesti" 
     3364 
    33223365#: app/views/customer_interface/_list_pagination.rhtml:15 
    33233366msgid "Previous" 
     
    33293372msgstr "Aikajana" 
    33303373 
    3331 #: app/views/customer_interface/index.rhtml:16 
     3374#: app/views/customer_interface/index.rhtml:17 
    33323375msgid "My assets" 
    33333376msgstr "Omat kohteet" 
    33343377 
    3335 #: app/views/customer_interface/index.rhtml:25 
     3378#: app/views/customer_interface/index.rhtml:26 
    33363379msgid "Open service requests" 
    33373380msgstr "Avoimet palvelupyynnöt" 
    33383381 
    3339 #: app/views/customer_interface/index.rhtml:36 
    33403382#: app/views/customer_interface/index.rhtml:39 
     3383#: app/views/customer_interface/index.rhtml:42 
    33413384msgid "Statistics" 
    33423385msgstr "Tilasto" 
    33433386 
    3344 #: app/views/customer_interface/index.rhtml:38 
     3387#: app/views/customer_interface/index.rhtml:41 
    33453388msgid "Open service requests by asset" 
    33463389msgstr "Avoimet palvelupyynnöt kohteittain" 
     
    34373480 
    34383481#: config/gettext_hack.rb:- 
     3482msgid "customer" 
     3483msgstr "asiakas" 
     3484 
     3485#: config/gettext_hack.rb:- 
     3486msgid "asset" 
     3487msgstr "kohde" 
     3488 
     3489#: config/gettext_hack.rb:- 
     3490msgid "Asset|Parent" 
     3491msgstr "Vanhempi" 
     3492 
     3493#: config/gettext_hack.rb:- 
     3494msgid "Asset|Asset type" 
     3495msgstr "Kohdetyyppi" 
     3496 
     3497#: config/gettext_hack.rb:- 
     3498msgid "Asset|Created at" 
     3499msgstr "Luotu" 
     3500 
     3501#: config/gettext_hack.rb:- 
     3502msgid "Asset|Code" 
     3503msgstr "Koodi" 
     3504 
     3505#: config/gettext_hack.rb:- 
     3506msgid "Asset|Name" 
     3507msgstr "Nimi" 
     3508 
     3509#: config/gettext_hack.rb:- 
     3510msgid "Asset|Description" 
     3511msgstr "Kuvaus" 
     3512 
     3513#: config/gettext_hack.rb:- 
     3514msgid "Asset|Lock timeout" 
     3515msgstr "Lukon aikakatkaisu" 
     3516 
     3517#: config/gettext_hack.rb:- 
     3518msgid "Asset|Lock user" 
     3519msgstr "Lukon omistaja" 
     3520 
     3521#: config/gettext_hack.rb:- 
     3522msgid "Asset|Use parents permissions" 
     3523msgstr "KÀytÀ ylemmÀn kohteen kÀyttöoikeuksia" 
     3524 
     3525#: config/gettext_hack.rb:- 
     3526msgid "Asset|Customer" 
     3527msgstr "Asiakas" 
     3528 
     3529#: config/gettext_hack.rb:- 
     3530msgid "task type" 
     3531msgstr "tehtÀvÀtyyppi" 
     3532 
     3533#: config/gettext_hack.rb:- 
     3534msgid "TaskType|Name" 
     3535msgstr "Nimi" 
     3536 
     3537#: config/gettext_hack.rb:- 
     3538msgid "TaskType|Description" 
     3539msgstr "Kuvaus" 
     3540 
     3541#: config/gettext_hack.rb:- 
     3542msgid "TaskType|Notification email" 
     3543msgstr "Ilmoitusten osoite" 
     3544 
     3545#: config/gettext_hack.rb:- 
     3546msgid "TaskType|Notify on create" 
     3547msgstr "Ilmoita luotaessa" 
     3548 
     3549#: config/gettext_hack.rb:- 
     3550msgid "TaskType|Notify on assign" 
     3551msgstr "Ilmoita mÀÀrÀtessÀ" 
     3552 
     3553#: config/gettext_hack.rb:- 
     3554msgid "TaskType|Notify on accept" 
     3555msgstr "Ilmoita hyvÀksyttÀessÀ" 
     3556 
     3557#: config/gettext_hack.rb:- 
     3558msgid "TaskType|Notify on close" 
     3559msgstr "Ilmoita suljettaessa" 
     3560 
     3561#: config/gettext_hack.rb:- 
     3562msgid "TaskType|Notify on open" 
     3563msgstr "Ilmoita avattaessa" 
     3564 
     3565#: config/gettext_hack.rb:- 
     3566msgid "TaskType|Is service request type" 
     3567msgstr "Palvelupyyntöjen tyyppi" 
     3568 
     3569#: config/gettext_hack.rb:- 
    34393570msgid "form" 
    34403571msgstr "lomake" 
     
    34853616 
    34863617#: config/gettext_hack.rb:- 
    3487 msgid "customer" 
    3488 msgstr "asiakas" 
    3489  
    3490 #: config/gettext_hack.rb:- 
    34913618msgid "attachment" 
    34923619msgstr "Liitetiedosto" 
     
    36273754msgid "Task|Other edit" 
    36283755msgstr "Muut muokkaus" 
    3629  
    3630 #: config/gettext_hack.rb:- 
    3631 msgid "asset" 
    3632 msgstr "kohde" 
    3633  
    3634 #: config/gettext_hack.rb:- 
    3635 msgid "Asset|Parent" 
    3636 msgstr "Vanhempi" 
    3637  
    3638 #: config/gettext_hack.rb:- 
    3639 msgid "Asset|Asset type" 
    3640 msgstr "Kohdetyyppi" 
    3641  
    3642 #: config/gettext_hack.rb:- 
    3643 msgid "Asset|Created at" 
    3644 msgstr "Luotu" 
    3645  
    3646 #: config/gettext_hack.rb:- 
    3647 msgid "Asset|Code" 
    3648 msgstr "Koodi" 
    3649  
    3650 #: config/gettext_hack.rb:- 
    3651 msgid "Asset|Name" 
    3652 msgstr "Nimi" 
    3653  
    3654 #: config/gettext_hack.rb:- 
    3655 msgid "Asset|Description" 
    3656 msgstr "Kuvaus" 
    3657  
    3658 #: config/gettext_hack.rb:- 
    3659 msgid "Asset|Lock timeout" 
    3660 msgstr "Lukon aikakatkaisu" 
    3661  
    3662 #: config/gettext_hack.rb:- 
    3663 msgid "Asset|Lock user" 
    3664 msgstr "Lukon omistaja" 
    3665  
    3666 #: config/gettext_hack.rb:- 
    3667 msgid "Asset|Use parents permissions" 
    3668 msgstr "KÀytÀ ylemmÀn kohteen kÀyttöoikeuksia" 
    3669  
    3670 #: config/gettext_hack.rb:- 
    3671 msgid "Asset|Customer" 
    3672 msgstr "Asiakas" 
    3673  
    3674 #: config/gettext_hack.rb:- 
    3675 msgid "task type" 
    3676 msgstr "tehtÀvÀtyyppi" 
    3677  
    3678 #: config/gettext_hack.rb:- 
    3679 msgid "TaskType|Name" 
    3680 msgstr "Nimi" 
    3681  
    3682 #: config/gettext_hack.rb:- 
    3683 msgid "TaskType|Description" 
    3684 msgstr "Kuvaus" 
    3685  
    3686 #: config/gettext_hack.rb:- 
    3687 msgid "TaskType|Notification email" 
    3688 msgstr "Ilmoitusten osoite" 
    3689  
    3690 #: config/gettext_hack.rb:- 
    3691 msgid "TaskType|Notify on create" 
    3692 msgstr "Ilmoita luotaessa" 
    3693  
    3694 #: config/gettext_hack.rb:- 
    3695 msgid "TaskType|Notify on assign" 
    3696 msgstr "Ilmoita mÀÀrÀtessÀ" 
    3697  
    3698 #: config/gettext_hack.rb:- 
    3699 msgid "TaskType|Notify on accept" 
    3700 msgstr "Ilmoita hyvÀksyttÀessÀ" 
    3701  
    3702 #: config/gettext_hack.rb:- 
    3703 msgid "TaskType|Notify on close" 
    3704 msgstr "Ilmoita suljettaessa" 
    3705  
    3706 #: config/gettext_hack.rb:- 
    3707 msgid "TaskType|Notify on open" 
    3708 msgstr "Ilmoita avattaessa" 
    3709  
    3710 #: config/gettext_hack.rb:- 
    3711 msgid "TaskType|Is service request type" 
    3712 msgstr "Palvelupyyntöjen tyyppi" 
    37133756 
    37143757#: config/gettext_hack.rb:23 
  • trunk/public/javascripts/application.js

    r509 r713  
    6060 * update_field_enabled('foobar') enables #foobar. Otherwise it disables 
    6161 * #foobar. 
    62  *  
     62 * 
    6363 * Parameters: 
    6464 * ----------- 
     
    7575    field.setAttribute('disabled', 'true'); 
    7676} 
     77 
     78/* Function: disable_notify_new_user 
     79 * ================================= 
     80 * Disables/enables the input with id 'model_notify_new_user' 
     81 * based on the content of the input with id 'model_email'. 
     82 */ 
     83function disable_notify_new_user() 
     84{ 
     85    var textField = $('model_email'); 
     86    var checkBox = $('model_notify_new_user'); 
     87 
     88    if (textField.value.length > 0) 
     89        checkBox.disabled = false; 
     90    else 
     91        checkBox.disabled = true; 
     92} 
  • trunk/test/functional/customer_controller_test.rb

    r708 r713  
    1515    @task_type = TaskType.create!(:name => 'Test') 
    1616    assert @task_type.set_as_service_request_type 
     17 
     18    ActionMailer::Base.delivery_method = :test 
     19    ActionMailer::Base.perform_deliveries = true 
     20    ActionMailer::Base.deliveries = [] 
    1721  end 
    1822 
     
    4751    get 'create' 
    4852    assert_response :success 
     53    assert_template 'customer/_create' 
    4954 
    5055    fields = assigns(:fields) 
     
    125130  end 
    126131 
     132  # Method: test_create_and_notify 
     133  # ============================== 
     134  # Checks that email notification is sent to new customer when notify_new_user is set. 
     135  # 
     136  def test_create_and_notify 
     137    @keyring.action_keys << create_action_key('customer/create') 
     138    login('test') 
     139 
     140    # Create a valid customer with minimal info 
     141    attributes = { 
     142      'login' => 'customer', 
     143      'password' => 'secret', 
     144      'password_confirmation' => 'secret', 
     145      'name' => 'Test', 
     146      'email' => 'test@example.com', 
     147      'notify_new_user' => '1' 
     148    } 
     149    post 'create', :model => attributes 
     150    assert_response :redirect 
     151    assert_redirected_to :controller => 'customer', :action => 'list' 
     152 
     153    # Check that the customer was added succesfully and 
     154    # that authentication works for him. 
     155    new_customer = UserAccount.authenticate(attributes['login'], attributes['password']) 
     156    assert_equal true, new_customer.is_a?(Customer) 
     157    assert_equal assigns(:model), new_customer 
     158 
     159  &nbs