company => { type => 'text' },
currency_id => { type => 'integer', not_null => 1 },
customer_hourly_rate => { type => 'numeric', precision => 8, scale => 2 },
+ customer_projects_only_in_sales => { type => 'boolean', default => 'false', not_null => 1 },
customernumber => { type => 'text' },
datev_check_on_ap_transaction => { type => 'boolean', default => 'true' },
datev_check_on_ar_transaction => { type => 'boolean', default => 'true' },
# Delivery orders
#======================================================================
+use List::MoreUtils qw(uniq);
use List::Util qw(max sum);
use POSIX qw(strftime);
use YAML;
$form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
$form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
- my @old_project_ids = ($form->{"globalproject_id"});
- map({ push(@old_project_ids, $form->{"project_id_$_"})
- if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
-
my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
- $form->get_lists("projects" => {
- "key" => "ALL_PROJECTS",
- "all" => 0,
- "old_id" => \@old_project_ids
- },
- $vc => "ALL_VC",
+ $form->get_lists($vc => "ALL_VC",
"price_factors" => "ALL_PRICE_FACTORS",
"departments" => "ALL_DEPARTMENTS",
"business_types" => "ALL_BUSINESS_TYPES",
);
+ # Projects
+ my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
+ my @old_ids_cond = @old_project_ids ? (id => \@old_project_ids) : ();
+ my @customer_cond;
+ if (($vc eq 'customers') && $::instance_conf->get_customer_projects_only_in_sales) {
+ @customer_cond = (
+ or => [
+ customer_id => $::form->{customer_id},
+ billable_customer_id => $::form->{customer_id},
+ ]);
+ }
+ my @conditions = (
+ or => [
+ and => [ active => 1, @customer_cond ],
+ @old_ids_cond,
+ ]);
+
+ $::form->{ALL_PROJECTS} = SL::DB::Manager::Project->get_all(query => \@conditions);
$::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]);
$::form->{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]);
$::form->{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all_sorted(query => [
use SL::OE;
use Data::Dumper;
use DateTime;
+use List::MoreUtils qw(uniq);
use List::Util qw(max sum);
use SL::DB::Default;
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
- my @old_project_ids = ($form->{"globalproject_id"});
- map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"};
-
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
- "all" => 0,
- "old_id" => \@old_project_ids },
- "taxzones" => "ALL_TAXZONES",
+ $form->get_lists("taxzones" => "ALL_TAXZONES",
"currencies" => "ALL_CURRENCIES",
"customers" => "ALL_CUSTOMERS",
"departments" => "all_departments",
"price_factors" => "ALL_PRICE_FACTORS");
+ # Projects
+ my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
+ my @old_ids_cond = @old_project_ids ? (id => \@old_project_ids) : ();
+ my @customer_cond;
+ if ($::instance_conf->get_customer_projects_only_in_sales) {
+ @customer_cond = (
+ or => [
+ customer_id => $::form->{customer_id},
+ billable_customer_id => $::form->{customer_id},
+ ]);
+ }
+ my @conditions = (
+ or => [
+ and => [ active => 1, @customer_cond ],
+ @old_ids_cond,
+ ]);
+
+ $TMPL_VAR{ALL_PROJECTS} = SL::DB::Manager::Project->get_all(query => \@conditions);
$TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]);
$TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]);
$TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all_sorted(query => [
use SL::MoreCommon qw(ary_diff);
use SL::PE;
use SL::ReportGenerator;
-use List::MoreUtils qw(any none);
+use List::MoreUtils qw(uniq any none);
use List::Util qw(min max reduce sum);
use Data::Dumper;
$form->{"closed"} ? "checked" : "", $locale->text('Closed') if $form->{id};
$TMPL_VAR{openclosed} = sprintf qq|<tr><td colspan=%d align=center>%s</td></tr>\n|, 2 * scalar @tmp, join "\n", @tmp if @tmp;
- # project ids
- my @old_project_ids = ($form->{"globalproject_id"}, grep { $_ } map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
-
my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
- "all" => 0,
- "old_id" => \@old_project_ids },
- "taxzones" => "ALL_TAXZONES",
+
+ # project ids
+ $form->get_lists("taxzones" => "ALL_TAXZONES",
"payments" => "ALL_PAYMENTS",
"currencies" => "ALL_CURRENCIES",
"departments" => "ALL_DEPARTMENTS",
limit => $myconfig{vclimit} + 1 },
"price_factors" => "ALL_PRICE_FACTORS");
+ # Projects
+ my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
+ my @old_ids_cond = @old_project_ids ? (id => \@old_project_ids) : ();
+ my @customer_cond;
+ if (($vc eq 'customers') && $::instance_conf->get_customer_projects_only_in_sales) {
+ @customer_cond = (
+ or => [
+ customer_id => $::form->{customer_id},
+ billable_customer_id => $::form->{customer_id},
+ ]);
+ }
+ my @conditions = (
+ or => [
+ and => [ active => 1, @customer_cond ],
+ @old_ids_cond,
+ ]);
+
+ $TMPL_VAR{ALL_PROJECTS} = SL::DB::Manager::Project->get_all(query => \@conditions);
+
# label subs
my $employee_list_query_gen = sub { $::form->{$_[0]} ? [ or => [ id => $::form->{$_[0]}, deleted => 0 ] ] : [ deleted => 0 ] };
$TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => $employee_list_query_gen->('employee_id'));
'If disabled purchase invoices can only be created by conversion from existing requests for quotations, purchase orders and purchase delivery orders.' => 'Falls deaktiviert, so können Einkaufsrechnungen nur durch Umwandlung aus bestehenden Preisanfragen, Lieferantenaufträgen und Einkaufslieferscheinen angelegt werden.',
'If disabled sales orders cannot be converted into sales invoices directly.' => 'Falls deaktiviert, so können Verkaufsangebote nicht direkt in Verkaufsrechnungen umgewandelt werden.',
'If disabled sales quotations cannot be converted into sales invoices directly.' => 'Falls deaktiviert, so können Verkaufsauträge nicht direkt in Verkaufsrechnungen umgewandelt werden.',
+ 'If enabled only those projects that are assigned to the currently selected customer are offered for selection in sales records.' => 'Wenn eingeschaltet, so werden in Verkaufsbelegen nur diejenigen Projekte zur Auswahl angeboten, die dem aktuell ausgewählten Kunden zugewiesen wurden.',
'If enabled purchase and sales records cannot be saved if no transaction description has been entered.' => 'Wenn angeschaltet, so können Einkaufs- und Verkaufsbelege nicht gespeichert werden, solange keine Vorgangsbezeichnung eingegeben wurde.',
'If missing then the start date will be used.' => 'Falls es fehlt, so wird die erste Rechnung für das Startdatum erzeugt.',
'If the article type is set to \'mixed\' then a column called \'type\' must be present.' => 'Falls der Artikeltyp auf \'gemischt\' gestellt wird, muss eine Spalte namens \'type\' vorhanden sein.',
'Only Warnings and Errors' => 'Nur Warnungen und Fehler',
'Only due follow-ups' => 'Nur fällige Wiedervorlagen',
'Only groups that have been configured for the client the user logs in to will be considered.' => 'Allerdings werden nur diejenigen Gruppen herangezogen, die für den Mandanten konfiguriert sind.',
+ 'Only list customer\'s projects in sales records' => 'Nur Projekte des Kunden in Verkaufsbelegen anzeigen',
'Only shown in item mode' => 'werden nur im Artikelmodus angezeigt',
'Oops. No valid action found to dispatch. Please report this case to the kivitendo team.' => 'Ups. Es wurde keine gültige Funktion zum Aufrufen gefunden. Bitte berichten Sie diesen Fall den kivitendo-Entwicklern.',
'Open' => 'Offen',
'Options' => 'Optionen',
'Or download the whole Installation Documentation as PDF (350kB) for off-line study (currently in German Language): ' => 'Oder laden Sie die komplette Installationsbeschreibung als PDF (350kB) herunter: ',
'Order' => 'Auftrag',
- 'Order Date missing!' => 'Auftragsdatum fehlt!',
'Order Date' => 'Auftragsdatum',
- 'Order Number missing!' => 'Auftragsnummer fehlt!',
+ 'Order Date missing!' => 'Auftragsdatum fehlt!',
'Order Number' => 'Auftragsnummer',
+ 'Order Number missing!' => 'Auftragsnummer fehlt!',
'Order amount' => 'Auftragswert',
'Order deleted!' => 'Auftrag gelöscht!',
- 'Order probability & expected billing date' => 'Auftragswahrscheinlichkeit & vorrauss. Abrechnungsdatum',
'Order probability' => 'Auftragswahrscheinlichkeit',
+ 'Order probability & expected billing date' => 'Auftragswahrscheinlichkeit & vorrauss. Abrechnungsdatum',
'Order/Item row name' => 'Name der Auftrag-/Positions-Zeilen',
'OrderItem' => 'Position',
- 'Ordered' => 'Vom Kunde bestellt',
'Ordered' => 'Von Kunden bestellt',
'Orders' => 'Aufträge',
'Orders / Delivery Orders deleteable' => 'Aufträge / Lieferscheine löschbar',
--- /dev/null
+-- @tag: defaults_only_customer_projects_in_sales
+-- @description: Mandantenkonfiguration: in Verkaufsbelegen nur Projekte des ausgewählten Kunden anbieten
+-- @depends: release_3_1_0
+ALTER TABLE defaults ADD COLUMN customer_projects_only_in_sales BOOLEAN;
+UPDATE defaults SET customer_projects_only_in_sales = FALSE;
+ALTER TABLE defaults
+ ALTER COLUMN customer_projects_only_in_sales SET DEFAULT FALSE,
+ ALTER COLUMN customer_projects_only_in_sales SET NOT NULL;
<td>[% LxERP.t8('If enabled purchase and sales records cannot be saved if no transaction description has been entered.') %]</td>
</tr>
+ <tr>
+ <td align="right">[% LxERP.t8("Only list customer's projects in sales records") %]</td>
+ <td>[% L.yes_no_tag("defaults.customer_projects_only_in_sales", SELF.defaults.customer_projects_only_in_sales) %]</td>
+ <td>[% LxERP.t8("If enabled only those projects that are assigned to the currently selected customer are offered for selection in sales records.") %]</td>
+ </tr>
+
<tr>
<td align="right">[% LxERP.t8('Allow conversion from sales quotations to sales invoices') %]</td>
<td>[% L.yes_no_tag('defaults.allow_sales_invoice_from_sales_quotation', SELF.defaults.allow_sales_invoice_from_sales_quotation) %]</td>