Revision 413

Date:
2014/02/11 22:47:35
Author:
ahitrov
Revision Log:
Payment libs and sql-table additions
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/webshop/lib/webshop/Delivery.pm

     
    13 13 [1, 'Действует'],
    14 14 ],
    15 15 },
    16 { 'attr' => 'dtime', 'hidden' => 1 },
    17 { 'attr' => 'price', 'type' => 'string', 'rusname' => 'Стоимость доставки (число)', default => 0 },
    16 { 'attr' => 'dtime', 'hidden' => 1, column => undef },
    17 { 'attr' => 'price', 'type' => 'string', 'rusname' => 'Стоимость доставки (число)', default => 0, column => 4 },
    18 18 { 'attr' => 'price_modify', 'type' => 'cost_level', 'rusname' => 'Стоимость доставки с учетом стоимости заказа' },
    19 19 { 'attr' => 'price_region', 'type' => 'cost_region', 'rusname' => 'Стоимость доставки с учетом региона' },
    20 20 { 'attr' => 'abstr', 'type' => 'text', 'rusname' => 'Краткое описание' },
  • utf8/plugins/webshop/lib/webshop/Init.pm

     
    21 21 webshop::Basket
    22 22 webshop::Order
    23 23 webshop::Delivery
    24 webshop::Payment
    24 25 webshop::Coupon
    25 26
    26 27 webshop::Country
     
    28 29 webshop::Town
    29 30
    30 31 webshop::DeliverySection
    32 webshop::PaymentSection
    31 33 webshop::RegionSection
    32 34
    33 35 webshop::CouponItemLink
     
    35 37 ));
    36 38
    37 39 sub init {
    38 push @{ $state->{'available_documents'} }, qw(webshop::Basket webshop::Order webshop::Delivery webshop::Coupon webshop::Country webshop::Area webshop::Town);
    39 push @{ $state->{'available_sections'} }, qw(webshop::DeliverySection webshop::RegionSection);
    40 push @{ $state->{'available_documents'} }, qw(webshop::Basket webshop::Order webshop::Delivery webshop::Payment webshop::Coupon webshop::Country webshop::Area webshop::Town);
    41 push @{ $state->{'available_sections'} }, qw(webshop::DeliverySection webshop::PaymentSection webshop::RegionSection);
    40 42 push @{ $state->{'available_links'} }, qw(webshop::CouponItemLink webshop::OrderCouponLink);
    41 43 0;
    42 44 }
  • utf8/plugins/webshop/lib/webshop/Order.pm

     
    21 21 'class' => 'webshop::Delivery',
    22 22 },
    23 23 },
    24 { 'attr' => 'pay_by', 'type' => 'lookup', 'rusname' => 'Тип оплаты', facilshow => 1, postshow => 1,
    25 'lookup_opts' => {
    26 'class' => 'webshop::Payment',
    27 },
    28 },
    24 29 { 'attr' => 'btime', 'type' => 'datetime', 'rusname' => 'Заказ отдан на комплектацию',
    25 30 postshow => 1, facilshow => 1 },
    26 31 { 'attr' => 'ftime', 'type' => 'datetime', 'rusname' => 'Заказ передан в доставку',
  • utf8/plugins/webshop/lib/webshop/Payment.pm

     
    1 package webshop::Payment;
    2
    3 use base "Contenido::Document";
    4
    5 sub extra_properties
    6 {
    7 return (
    8 { 'attr' => 'status', 'type' => 'status', 'rusname' => 'Статус',
    9 'cases' => [
    10 [0, 'Не активен'],
    11 [1, 'Действует'],
    12 ],
    13 },
    14 { 'attr' => 'dtime', 'hidden' => 1, column => undef },
    15 { 'attr' => 'class', 'column' => undef },
    16 { 'attr' => 'abstr', 'type' => 'text', 'rusname' => 'Краткое описание' },
    17 { 'attr' => 'online', 'type' => 'checkbox', 'rusname' => 'Онлайн-оплата', column => 4 },
    18 { 'attr' => 'url', 'type' => 'string', 'rusname' => 'URL перехода на страницу оплаты',
    19 'shortname' => 'URL перехода', column => 5,
    20 'rem' => 'техническое поле, заполняется программистом' },
    21 # { 'attr' => 'handler', 'type' => 'string', 'rusname' => 'Обработчик', rem => 'техническое поле, заполняется программистом' },
    22 )
    23 }
    24
    25
    26 sub class_name
    27 {
    28 return 'Способ оплаты';
    29 }
    30
    31 sub class_description
    32 {
    33 return 'Способ оплаты';
    34 }
    35
    36 sub pre_store
    37 {
    38 my $self = shift;
    39
    40 my $default_section = $project->s_alias->{payment} if ref $project->s_alias eq 'HASH' && exists $project->s_alias->{payment};
    41 my $sections = $self->{sections};
    42 if ( $default_section ) {
    43 if ( ref $sections eq 'ARRAY' && scalar @$sections ) {
    44 my @new_sects = grep { $_ != $default_section } @$sections;
    45 push @new_sects, $default_section;
    46 $self->sections(@new_sects);
    47 } elsif ( $sections && !ref $sections && $sections != $default_section ) {
    48 my @new_sects = ($sections, $default_section);
    49 $self->sections(@new_sects);
    50 } else {
    51 $self->sections($default_section);
    52 }
    53 }
    54
    55 return 1;
    56 }
    57
    58 1;
  • utf8/plugins/webshop/lib/webshop/PaymentSection.pm

     
    1 package webshop::PaymentSection;
    2
    3 use base 'Contenido::Section';
    4
    5 sub extra_properties
    6 {
    7 return (
    8 { 'attr' => 'brief', 'type' => 'text', 'rusname' => 'Описание секции' },
    9 { 'attr' => 'default_document_class', 'default' => 'webshop::Payment' },
    10 { 'attr' => '_sorted', 'default' => 1 },
    11 { 'attr' => 'filters', 'hidden' => 1 },
    12 { 'attr' => 'order_by', 'hidden' => 1 },
    13 )
    14 }
    15
    16 sub class_name
    17 {
    18 return 'Cпособы оплаты';
    19 }
    20
    21 sub class_description
    22 {
    23 return 'Cпособы оплаты';
    24 }
    25
    26 1;
  • utf8/plugins/webshop/lib/webshop/SQL/Order.pm

     
    23 23 _previous_days_filter
    24 24 _s_filter
    25 25
    26 _payment_filter
    26 27 _uid_filter
    27 28 _manager_filter
    28 29 _vault_filter
     
    157 158 'db_field' => 'status',
    158 159 'db_type' => 'integer',
    159 160 },
    161 {
    162 'attr' => 'payment',
    163 'type' => 'checkbox',
    164 'postshow' => 1,
    165 'facilshow' => 1,
    166 'column' => 8,
    167 'rusname' => 'Оплачен',
    168 'db_field' => 'payment',
    169 'db_type' => 'integer',
    170 },
    160 171 );
    161 172
    162 173 # ----------------------------------------------------------------------------
     
    188 199 return undef;
    189 200 }
    190 201
    202 sub _payment_filter {
    203 my ($self,%opts)=@_;
    204 return undef unless ( exists $opts{payment} );
    205 return &SQL::Common::_generic_int_filter('d.payment', $opts{payment});
    206 }
    207
    191 208 sub _uid_filter {
    192 209 my ($self,%opts)=@_;
    193 210 return undef unless ( exists $opts{uid} );
  • utf8/plugins/webshop/sql/TOAST/orders.sql

     
    5 5 dtime timestamp without time zone DEFAULT now() NOT NULL,
    6 6 class text DEFAULT 'webshop::Order'::text NOT NULL,
    7 7 status smallint default 0 NOT NULL,
    8 payment smallint default 0,
    8 9 sections integer[],
    9 10 uid integer,
    10 11 manager_id integer,