Revision 727
- Date:
- 2018/10/09 12:36:57
- Files:
-
- /utf8/plugins/webshop/lib/webshop/Delivery.pm (Diff) (Checkout)
- /utf8/plugins/webshop/lib/webshop/Init.pm (Diff) (Checkout)
- /utf8/plugins/webshop/lib/webshop/SQL/AddressTable.pm (Diff) (Checkout)
- /utf8/plugins/webshop/lib/webshop/SQL/DeliveryTable.pm (Diff) (Checkout)
- /utf8/plugins/webshop/sql/TOAST/adresses.sql (Diff) (Checkout)
- /utf8/plugins/webshop/sql/TOAST/adresses.update.727.sql (Diff) (Checkout)
- /utf8/plugins/webshop/sql/TOAST/delivery.sql (Diff) (Checkout)
Legend:
- Added
- Removed
- Modified
-
utf8/plugins/webshop/lib/webshop/Delivery.pm
103 103 return 'Способ доставки'; 104 104 } 105 105 106 sub class_table 107 { 108 return 'webshop::SQL::DeliveryTable'; 109 } 110 106 111 sub pre_store 107 112 { 108 113 my $self = shift; -
utf8/plugins/webshop/lib/webshop/Init.pm
12 12 # webshop::SQL::SomeTable 13 13 # webshop::SomeClass 14 14 Contenido::Init::load_classes(qw( 15 webshop::SQL::AddressTable 15 16 webshop::SQL::Basket 17 webshop::SQL::DeliveryTable 16 18 webshop::SQL::Order 17 19 webshop::SQL::CouponsTable 18 20 webshop::SQL::CouponLinkTable -
utf8/plugins/webshop/lib/webshop/SQL/AddressTable.pm
24 24 _s_filter 25 25 26 26 _uid_filter 27 _active_delivery_filter 27 28 )]; 28 29 29 30 sub available_filters { … … 84 85 return &SQL::Common::_generic_int_filter('d.sections', $opts{s}); 85 86 } 86 87 88 sub _active_delivery_filter { 89 my ($self,%opts)=@_; 90 return undef unless ( exists $opts{active} && $opts{active} ); 91 return ([], [], " join webshop_delivery as l on l.id=d.delivery_id and l.status > 0 "); 92 } 93 87 94 1; -
utf8/plugins/webshop/lib/webshop/SQL/DeliveryTable.pm
1 package webshop::SQL::DeliveryTable; 2 3 use base 'SQL::DocumentTable'; 4 5 sub db_table 6 { 7 return 'webshop_delivery'; 8 } 9 10 my $available_filters = [qw( 11 12 _class_filter 13 _status_filter 14 _in_id_filter 15 _id_filter 16 _name_filter 17 _class_excludes_filter 18 _sfilter_filter 19 _excludes_filter 20 _datetime_filter 21 _date_equal_filter 22 _date_filter 23 _previous_days_filter 24 _s_filter 25 26 _alias_filter 27 )]; 28 29 sub available_filters { 30 return $available_filters; 31 } 32 33 34 # ---------------------------------------------------------------------------- 35 # Свойства храним в массивах, потому что порядок важен! 36 # Это общие свойства - одинаковые для всех документов. 37 # 38 # attr - обязательный параметр, название атрибута; 39 # type - тип аттрибута, требуется для отображдения; 40 # rusname - русское название, опять же требуется для отображения; 41 # hidden - равен 1, когда 42 # readonly - инициализации при записи только без изменения в дальнейшем 43 # db_field - поле в таблице 44 # default - значение по умолчанию (поле всегда имеет это значение) 45 # ---------------------------------------------------------------------------- 46 sub required_properties 47 { 48 my $self = shift; 49 50 my @parent_properties = $self->SUPER::required_properties; 51 return ( 52 @parent_properties, 53 { # User ID 54 'attr' => 'alias', 55 'type' => 'string', 56 'rusname' => 'Alias доставки', 57 'db_field' => 'alias', 58 'db_type' => 'text', 59 }, 60 ); 61 } 62 63 ########### FILTERS DESCRIPTION ############################################################################### 64 sub _alias_filter { 65 my ($self,%opts)=@_; 66 return undef unless ( exists $opts{alias} ); 67 return &SQL::Common::_generic_text_filter('d.alias', $opts{alias}); 68 } 69 70 1; -
utf8/plugins/webshop/sql/TOAST/adresses.sql
7 7 status smallint default 0 NOT NULL, 8 8 sections integer, 9 9 uid integer not null, 10 delivery_id integer references webshop_delivery(id) ON DELETE RESTRICT, 10 11 name text, 11 12 data text 12 13 ); -
utf8/plugins/webshop/sql/TOAST/adresses.update.727.sql
1 alter table adresses add column delivery_id integer references webshop_delivery(id) ON DELETE RESTRICT; -
utf8/plugins/webshop/sql/TOAST/delivery.sql
1 CREATE TABLE webshop_delivery ( 2 id integer NOT NULL primary key DEFAULT nextval(('public.documents_id_seq'::text)::regclass), 3 ctime timestamp without time zone DEFAULT now() NOT NULL, 4 mtime timestamp without time zone DEFAULT now() NOT NULL, 5 dtime timestamp without time zone DEFAULT now() NOT NULL, 6 class text DEFAULT 'webshop::Delivery'::text NOT NULL, 7 status smallint default 0 NOT NULL, 8 sections integer[], 9 name text, 10 alias text, 11 data text 12 ); 13 14 create index webshop_delivery_sections on webshop_delivery using gist ( "sections" "gist__int_ops" );