Revision 434

Date:
2014/04/13 21:57:03
Author:
ahitrov
Revision Log:
Payment alias (additional field)
company_id field for webshop::Order (b2b)
Files:

Legend:

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

     
    345 345 my (%opts) = @_;
    346 346
    347 347 my $list = delete $opts{list};
    348 $opts{order_by} ||= 'status';
    349 my @items = $keeper->get_documents (
    350 class => 'webshop::Order',
    351 %opts,
    352 );
    353 if ( exists $opts{id} && defined $opts{id} && !ref $opts{id} ) {
    354 if ( $list ) {
    355 $items[0]->{list} = $self->get_order_list( order_id => $opts{id} );
    356 }
    357 return $items[0];
    348 my $count = delete $opts{count};
    349 if ( $count ) {
    350 delete $opts{order_by};
    351 my $item_count = $keeper->get_documents (
    352 class => 'webshop::Order',
    353 count => 1,
    354 %opts,
    355 );
    356 return $item_count;
    358 357 } else {
    359 if ( $list ) {
    360 map { $_->{list} = $self->get_order_list( order_id => $_->id ) } @items;
    358 $opts{order_by} ||= 'status';
    359 my @items = $keeper->get_documents (
    360 class => 'webshop::Order',
    361 %opts,
    362 );
    363 if ( exists $opts{id} && defined $opts{id} && !ref $opts{id} ) {
    364 if ( $list ) {
    365 $items[0]->{list} = $self->get_order_list( order_id => $opts{id} );
    366 }
    367 return $items[0];
    368 } else {
    369 if ( $list ) {
    370 map { $_->{list} = $self->get_order_list( order_id => $_->id ) } @items;
    371 }
    372 return \@items;
    361 373 }
    362 return \@items;
    363 374 }
    364 375 }
    365 376
  • utf8/plugins/webshop/lib/webshop/Order.pm

     
    26 26 'class' => 'webshop::Payment',
    27 27 },
    28 28 },
    29 { 'attr' => 'pay_alias', 'type' => 'string', 'rusname' => 'Название метода оплаты', shortname => 'Оплата',
    30 postshow => 1, facilshow => 1 },
    29 31 { 'attr' => 'btime', 'type' => 'datetime', 'rusname' => 'Заказ отдан на комплектацию',
    30 32 postshow => 1, facilshow => 1 },
    31 33 { 'attr' => 'ftime', 'type' => 'datetime', 'rusname' => 'Заказ передан в доставку',
  • utf8/plugins/webshop/lib/webshop/Payment.pm

     
    13 13 },
    14 14 { 'attr' => 'dtime', 'hidden' => 1, column => undef },
    15 15 { 'attr' => 'class', 'column' => undef },
    16 { 'attr' => 'alias', 'type' => 'string', 'column' => undef. 'rusname' => 'Алиас метода оплаты' },
    16 17 { 'attr' => 'abstr', 'type' => 'text', 'rusname' => 'Краткое описание' },
    17 18 { 'attr' => 'online', 'type' => 'checkbox', 'rusname' => 'Онлайн-оплата', column => 4 },
    18 19 { 'attr' => 'url', 'type' => 'string', 'rusname' => 'URL перехода на страницу оплаты',
  • utf8/plugins/webshop/lib/webshop/SQL/Order.pm

     
    25 25
    26 26 _payment_filter
    27 27 _uid_filter
    28 _company_filter
    28 29 _manager_filter
    29 30 _vault_filter
    30 31 _postman_filter
     
    74 75 'db_opts' => "not null default 0",
    75 76 'default' => 0,
    76 77 },
    78 {
    79 'attr' => 'company_id',
    80 'type' => 'integer',
    81 'rusname' => 'ID компании',
    82 'hidden' => 1,
    83 'db_field' => 'company_id',
    84 'db_type' => 'integer',
    85 'db_opts' => "not null default 0",
    86 'default' => 0,
    87 },
    77 88 { # User ID
    78 89 'attr' => 'manager_id',
    79 90 'type' => 'string',
     
    211 222 return &SQL::Common::_generic_int_filter('d.uid', $opts{uid});
    212 223 }
    213 224
    225 sub _company_filter {
    226 my ($self,%opts)=@_;
    227 return undef unless ( exists $opts{company_id} );
    228 return &SQL::Common::_generic_int_filter('d.company_id', $opts{company_id});
    229 }
    230
    214 231 sub _manager_filter {
    215 232 my ($self,%opts)=@_;
    216 233 return undef unless ( exists $opts{manager} );
  • utf8/plugins/webshop/sql/TOAST/orders.sql

     
    8 8 payment smallint default 0,
    9 9 sections integer[],
    10 10 uid integer,
    11 company_id integer,
    11 12 manager_id integer,
    12 13 vault_id integer,
    13 14 postman_id integer,
  • utf8/plugins/webshop/sql/TOAST/orders.update.444.sql

     
    1 alter table orders add column company_id integer;