Revision 388

Date:
2013/10/22 17:09:20
Author:
ahitrov
Revision Log:
1. document_id_seq can be redefined
2. Group section adjust and move bug fix
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/core/comps/contenido/sections.html

     
    306 306 if ( exists $ARGS{tree} && $ARGS{tree} && $ARGS{tree} != $owner->id ) {
    307 307 my %updated;
    308 308 while ( my ($field, $value) = each %ARGS ) {
    309 if ( $field =~ /^update_(\d+)_(\w+)$/ ) {
    309 if ( $field =~ /^delete_(\d+)_(\w+)$/ ) {
    310 310 my $oid = $1;
    311 311 my $attr = $2;
    312 312 $updated{$oid}{$attr} = $value;
    313 313 }
    314 314 }
    315 warn Dumper \%updated;
    315 316 my %classes = map { $_->{class} => 1 } values %updated;
    316 317 my $parent_new = $keeper->get_section_by_id( $ARGS{tree} );
    317 318 my $document_access = $user->section_accesses($user, $parent_new->id);
     
    319 320 foreach my $update_class ( keys %classes ) {
    320 321 my @ids;
    321 322 while ( my ($oid, $attr) = each %updated) {
    322 push @ids, $oid if $attr->{class} eq $update_class;
    323 push @ids, $oid if exists $attr->{id} && $attr->{id} && ($attr->{class} eq $update_class);
    323 324 }
    324 325 my @objects = $keeper->get_documents (
    325 326 id => \@ids,
  • utf8/core/lib/Contenido/Object.pm

     
    596 596 }
    597 597 $sth->finish();
    598 598
    599 my $id = $self->keeper->TSQL->selectrow_array("SELECT currval('documents_id_seq')");
    599 my $id = $self->keeper->TSQL->selectrow_array("SELECT currval('".$self->class_table->db_id_sequence()."')");
    600 600 $self->id($id);
    601 601 return $self->t_abort("Документу присвоен неверный идентификатор") if (! defined($self->{id}) || ($self->{id} <= 0));
    602 602
  • utf8/core/lib/SQL/DocumentTable.pm

     
    45 45 # ----------------------------------------------------------------------------
    46 46 sub required_properties
    47 47 {
    48 my $self = shift;
    49 my $id_sequence = $self->db_id_sequence();
    48 50 return (
    49 51 { # Идентификатор документа, сквозной по всем типам...
    50 52 'attr' => 'id',
     
    55 57 'auto' => 1,
    56 58 'db_field' => 'id',
    57 59 'db_type' => 'integer',
    58 'db_opts' => "not null default nextval('public.documents_id_seq'::text)",
    60 'db_opts' => "not null default nextval('public.$id_sequence'::text)",
    59 61 },
    60 62 { # Класс документа...
    61 63 'attr' => 'class',
  • utf8/core/lib/SQL/ProtoTable.pm

     
    29 29 return 0;
    30 30 }
    31 31
    32 sub db_id_sequence {
    33 return 'documents_id_seq';
    34 }
    35
    32 36 sub available_filters {
    33 37 return ();
    34 38 }