Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for web-apps/finance-manager/modules/Source.pm between version 1.2 and 1.3

version 1.2, 2004/02/20 11:56:31 version 1.3, 2004/04/04 17:44:16
Line 50  sub _prepare_sql($$;)
Line 50  sub _prepare_sql($$;)
   
         my ($self, $globals, $dbh) = @_;          my ($self, $globals, $dbh) = @_;
   
         $self->{get_all_sources} = $dbh->prepare("          $self->{get_all_sources} = $dbh->prepare(" /* get_all_sources " . __FILE__ . ":" . __LINE__ . " */
                 SELECT                  SELECT
                         sourceid, active,                          sourceid, active,
                         name, description, note,                          name, description, note,
Line 59  sub _prepare_sql($$;)
Line 59  sub _prepare_sql($$;)
                         low_money, medium_money, high_money                          low_money, medium_money, high_money
                 FROM Source                  FROM Source
                 ORDER BY sourceid                  ORDER BY sourceid
         ") or croak "Can't get list of sources" . $dbh::errstr;          ") or croak "Can't get list of sources: " . $dbh::errstr;
   
         $self->{get_source} = $dbh->prepare("          $self->{get_source} = $dbh->prepare(" /* get_source " . __FILE__ . ":" . __LINE__ . " */
                 SELECT                  SELECT
                         sourceid, active,                          sourceid, active,
                         name, description, note,                          name, description, note,
Line 70  sub _prepare_sql($$;)
Line 70  sub _prepare_sql($$;)
                         low_money, medium_money, high_money                          low_money, medium_money, high_money
                 FROM Source                  FROM Source
                 WHERE sourceid = ?                  WHERE sourceid = ?
         ") or croak "Can't get list of sources" . $dbh::errstr;          ") or croak "Can't get list of sources: " . $dbh::errstr;
         $self->{get_source}->bind_param(1, 0, SQL_INTEGER);          $self->{get_source}->bind_param(1, 0, SQL_INTEGER);
   
           $self->{new_source} = $dbh->prepare(" /* new_source " . __FILE__ . ":" . __LINE__ . " */
                   INSERT INTO Source
                           (created, active,
                           start_money, stop_money,
                           low_money, medium_money, high_money,
                           name, description, note)
                   VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?) /* 10x otaznik */
           ") or croak "Can't create new source: " . $dbh::errstr;
           foreach my $i (1..6) {
                   $self->{new_source}->bind_param($i, 0, SQL_INTEGER);
           }
   
 } # }}} _prepare_sql  } # }}} _prepare_sql
   
 # return list of all finacial sources  # return list of all finacial sources
Line 98  sub get($;)
Line 110  sub get($;)
         return $source_data;          return $source_data;
 } # }}} get  } # }}} get
   
   # create new Source
   sub new_source($;)
   { # {{{
           my ($self, $data) = @_;
   
           foreach my $key ('active', 'start_money', 'stop_money',
                   'low_money', 'medium_money', 'high_money',
                   'name', 'description', 'note') {
                   unless (defined $data->{$key}) {
                           croak "Undefined REQUIRED parameter '$key'";
                   }
           }
           foreach my $key ('active', 'start_money', 'stop_money',
                   'low_money', 'medium_money', 'high_money') {
                   if ($data->{$key} !~ m/^\d+$/) {
                           carp "Parameter '$key' ('$data->{$key}') is not numeric";
                           $data->{$key} = 0;
                   }
           }
   
           $self->{new_source}->execute(
                           $data->{active},
                           $data->{start_money}, $data->{stop_money},
                           $data->{low_money}, $data->{medium_money}, $data->{high_money},
                           $data->{name}, $data->{description}, $data->{note}
           );
   
           return 1;
   } # }}} get
   
 1;  1;
   
 __END__  __END__

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top