lib/pack_material/services/complete_purchase_invoice.rb
# rubocop:disable Metrics/ClassLength
# Complete a purchase invoice and send XML representation to accounting system.
# - use the `just_show_xml` flag to check the XML output without modifying the db.
#
# @param user_name [string] the user who initiated this task.
# @param opts [Hash] { delivery_id [integer], mr_goods_returned_note_id [integer] }
# @param just_show_xml [bool] set to true to just return XML from the call without updating the db.
disable Metrics/ClassLength
Complete a purchase invoice and send XML representation to accounting system.
use the `just_show_xml` flag to check the XML output without modifying the db.
disable Metrics / ClassLength Complete a purchase invoice and send XML representation to accounting system . use the ` just_show_xml ` flag to check the XML output without modifying the db .
def apply_delivery_changes(formatted_res)
      @repo.transaction do
        if formatted_res.success
          @replenish_repo.delivery_complete_invoice(@user_name, @id, formatted_res.instance)
          @repo.log_status('mr_deliveries', @id, 'PURCHASE INVOICE COMPLETED', user_name: @user_name)
        else
          @replenish_repo.update_mr_delivery(@id, invoice_error: true)
          @repo.log_status('mr_deliveries', @id, formatted_res.message, user_name: @user_name)
        end
        @block&.call
      end
    end
def apply_delivery_changes ( formatted_res ) @repo . transaction do if formatted_res . success @replenish_repo . delivery_complete_invoice ( @user_name , @id , formatted_res . instance ) @repo . log_status ( 'mr_deliveries' , @id , 'PURCHASE INVOICE COMPLETED' , user_name : @user_name ) else @replenish_repo . update_mr_delivery ( @id , invoice_error : true ) @repo . log_status ( 'mr_deliveries' , @id , formatted_res . message , user_name : @user_name ) end @block &. call end end
rubocop:disable Metrics/ClassLength
Complete a purchase invoice and send XML representation to accounting system.
rubocop : disable Metrics / ClassLength Complete a purchase invoice and send XML representation to accounting system .
formatted_res
<not_specific>
user_name
<not_specific>
the user who initiated this task.
the user who initiated this task .
opts
<not_specific>
{ delivery_id [integer], mr_goods_returned_note_id [integer] }
{ delivery_id [ integer ] mr_goods_returned_note_id [ integer ] }
just_show_xml
<not_specific>
set to true to just return XML from the call without updating the db.
set to true to just return XML from the call without updating the db .