1 package SL::DB::Manager::Project;
 
   5 use parent qw(SL::DB::Helper::Manager);
 
   7 use SL::DB::Helper::Paginated;
 
   8 use SL::DB::Helper::Sorted;
 
  10 sub object_class { 'SL::DB::Project' }
 
  12 __PACKAGE__->make_manager_methods;
 
  14 our %project_id_column_prefixes = (
 
  18   delivery_orders => 'global',
 
  21 our @tables_with_project_id_cols = qw(acc_trans ap ar delivery_order_items delivery_orders invoice oe orderitems rmaitems);
 
  25     default    => [ 'projectnumber', 1 ],
 
  28       customer => 'customer.name',
 
  32 sub is_not_used_filter {
 
  33   my ($class, $prefix) = @_;
 
  35   my $query = join ' UNION ', map {
 
  36     my $column = $project_id_column_prefixes{$_} . 'project_id';
 
  37     qq|SELECT DISTINCT ${column} FROM ${_} WHERE ${column} IS NOT NULL|
 
  38   } @tables_with_project_id_cols;
 
  40   return ("!${prefix}id" => [ \"(${query})" ]);
 
  52 SL::DB::Manager::Project - Manager for models for the 'project' table
 
  56 This is a standard Rose::DB::Manager based model manager and can be
 
  63 =item C<is_not_used_filter>
 
  65 Returns an array containing a partial filter suitable for the C<query>
 
  66 parameter that limits to projects that are not referenced from any
 
  77 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>