This commit is contained in:
Nicolas Bally 2020-02-11 12:37:04 +01:00
parent af27b769e1
commit f6529ff3f3
6 changed files with 72 additions and 9 deletions

View File

@ -88,7 +88,7 @@ gem "nokogiri"
gem 'twitter-text'
gem 'pygments.rb'
gem 'pygments.rb', "1.2.1"
gem 'redcarpet'
gem 'omniauth-facebook'

View File

@ -75,7 +75,7 @@ GEM
countries (~> 1.2.0)
sort_alphabetical (~> 1.0)
crass (1.0.4)
curb (0.8.8)
curb (0.9.10)
currencies (0.4.2)
debug_inspector (0.0.2)
debugger-linecache (1.2.0)
@ -186,10 +186,9 @@ GEM
xml-simple
paypal-sdk-merchant (1.117.2)
paypal-sdk-core (~> 0.3.0)
posix-spawn (0.3.11)
pygments.rb (0.6.3)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.2.0)
posix-spawn (0.3.13)
pygments.rb (1.2.1)
multi_json (>= 1.0.0)
rack (1.6.11)
rack-test (0.6.3)
rack (>= 1.0)
@ -311,7 +310,6 @@ GEM
wicked_pdf (0.11.0)
rails
xml-simple (1.1.5)
yajl-ruby (1.2.1)
PLATFORMS
ruby
@ -344,7 +342,7 @@ DEPENDENCIES
omniauth-facebook
paypal-sdk-merchant
posix-spawn
pygments.rb
pygments.rb (= 1.2.1)
rails (= 4.2.10)
rails_autolink
redcarpet
@ -367,4 +365,4 @@ DEPENDENCIES
wicked_pdf
BUNDLED WITH
1.16.2
1.17.3

View File

@ -65,6 +65,61 @@ class Admin::PCustomerSheetsController < ApplicationController
end
def dup
@past_customer_sheet = PCustomerSheet.find(params[:id])
@p_customer_sheet = PCustomerSheet.new(:p_customer => @past_customer_sheet.p_customer, :wish_start => Date.today, :wish_stop => ((Date.today + 7.day).end_of_week)-2.day)
@p_customer_sheet.particular_bill_id = @past_customer_sheet.particular_bill_id
@p_customer_sheet.particular_send_id = @past_customer_sheet.particular_send_id
@p_customer_sheet.cust_ref = @past_customer_sheet.cust_ref
@past_customer_sheet.p_sheet_lines.each do |p_sheet_line|
new_p_sheet_line = p_sheet_line.dup
p_sheet_line.p_sheet_line_lines.each do |p_sheet_line_line|
new_p_sheet_line.p_sheet_line_lines << p_sheet_line_line.dup
end
p_sheet_line.p_sheet_line_stocks.each do |p_sheet_line_stock|
new_p_sheet_line.p_sheet_line_stocks << p_sheet_line_stock.dup
end
@p_customer_sheet.p_sheet_lines << new_p_sheet_line
end
@p_customer_sheet.fdp_force_price = @past_customer_sheet.fdp_force_price
@p_customer_sheet.obs_devis = @past_customer_sheet.obs_devis
@p_customer_sheet.obs_bdc = @past_customer_sheet.obs_bdc
@p_customer_sheet.obs_bdl = @past_customer_sheet.obs_bdl
@p_customer_sheet.p_payment_type_id = @past_customer_sheet.p_payment_type_id
@p_customer_sheet.comptant = @past_customer_sheet.comptant
@p_customer_sheet.acompte = @past_customer_sheet.acompte
@p_customer_sheet.acompte_percent = @past_customer_sheet.acompte_percent
@p_customer_sheet.payment_delais = @past_customer_sheet.payment_delais
@p_customer_sheet.payment_fin_de_mois = @past_customer_sheet.payment_fin_de_mois
@p_customer_sheet.save
redirect_to admin_p_customer_sheets_path()
end

View File

@ -63,6 +63,10 @@ class Admin::PCustomersController < ApplicationController
@p_customer = PCustomer.find(params[:id])
end
def create
@p_customer = PCustomer.new(params.require(:p_customer).permit!)

View File

@ -23,6 +23,10 @@
%td.actions
=link_to i(:copy), dup_admin_p_customer_sheet_path(p_customer_sheet), :data => {:confirm => 'Voulez-vous vraiment dupliquer cette commande ?'}
-if p_customer_sheet.state == "brouillon"
= link_to i(:"trash-o"), [:admin, p_customer_sheet], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet auteur ? ' } , :remote => true
= link_to i(:pencil), edit_admin_p_customer_sheet_path(p_customer_sheet), :remote => false

View File

@ -243,6 +243,8 @@ Rails.application.routes.draw do
get :cancel
get :uncancel
get :dup
get :set_sheet_line_ship
post :set_sheet_line_ship_save