my $h_id = prepare_query($form, $dbh, $q_id);
my $q_new =
- qq|INSERT INTO custom_variable_configs (name, description, type, default_value, options, searchable, includeable, included_by_default, module, id, sortkey)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
+ qq|INSERT INTO custom_variable_configs (name, description, type, default_value, options, searchable, includeable, included_by_default, module, flags, id, sortkey)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
(SELECT COALESCE(MAX(sortkey) + 1, 1) FROM custom_variable_configs))|;
my $h_new = prepare_query($form, $dbh, $q_new);
type = ?, default_value = ?,
options = ?, searchable = ?,
includeable = ?, included_by_default = ?,
- module = ?
+ module = ?, flags = ?
WHERE id = ?|;
my $h_update = prepare_query($form, $dbh, $q_update);
do_statement($form, $h_actual, $q_actual, @{$config}{qw(name description type default_value options)},
$config->{searchable} ? 't' : 'f', $config->{includeable} ? 't' : 'f', $config->{included_by_default} ? 't' : 'f',
- $params{module}, conv_i($config->{id}));
+ $params{module}, $config->{flags}, conv_i($config->{id}));
}
$h_id->finish();
use List::MoreUtils qw(all);
use YAML;
+use SL::CVar;
use SL::DBUtils;
sub get_part {
}
}
+ CVar->save_custom_variables('dbh' => $dbh,
+ 'module' => 'IC',
+ 'trans_id' => $form->{id},
+ 'variables' => $form);
+
# commit
my $rc = $dbh->commit;
$dbh->disconnect;
my $where_clause = join ' AND ', map { "($_)" } @where_tokens;
my $group_clause = ' GROUP BY ' . join ', ', map { ($table_prefix{$_} || "p.") . $_ } @group_tokens if scalar @group_tokens;
+ my ($cvar_where, @cvar_values) = CVar->build_filter_query('module' => 'IC',
+ 'trans_id_field' => 'p.id',
+ 'filter' => $form);
+
+ if ($cvar_where) {
+ $where_clause .= qq| AND ($cvar_where)|;
+ push @bind_vars, @cvar_values;
+ }
+
my $query = qq|SELECT DISTINCT $select_clause FROM parts p $join_clause WHERE $where_clause $group_clause $order_clause $limit_clause|;
$form->{parts} = selectall_hashref_query($form, $dbh, $query, @bind_vars);
my $previous_config;
- foreach (@configs) {
- $_->{type_tr} = $translations{$_->{type}};
+ foreach my $config (@configs) {
+ $config->{type_tr} = $translations{$config->{type}};
+
+ foreach my $flag (split m/:/, $config->{flags}) {
+ if ($flag =~ m/(.*?)=(.*)/) {
+ $config->{"flag_${1}"} = $2;
+ } else {
+ $config->{"flag_${flag}"} = 1;
+ }
+ }
if ($previous_config) {
- $previous_config->{next_id} = $_->{id};
- $_->{previous_id} = $previous_config->{id};
+ $previous_config->{next_id} = $config->{id};
+ $config->{previous_id} = $previous_config->{id};
}
- $previous_config = $_;
+ $previous_config = $config;
}
$form->{title} = $locale->text('List of custom variables');
$form->{included_by_default} = $form->{inclusion} eq 'yes_default_on';
$form->{includeable} = $form->{inclusion} ne 'no';
+ $form->{flags} = join ':', map { m/^flag_(.*)/; "${1}=" . $form->{$_} } grep { m/^flag_/ } keys %{ $form };
CVar->save_config('module' => $form->{module},
'config' => $form);
use List::MoreUtils qw(any);
use SL::AM;
+use SL::CVar;
use SL::IC;
use SL::ReportGenerator;
$form->{jsscript} = 1;
+ $form->{CUSTOM_VARIABLES} = CVar->get_configs('module' => 'IC');
+ ($form->{CUSTOM_VARIABLES_FILTER_CODE},
+ $form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables' => $form->{CUSTOM_VARIABLES},
+ 'include_prefix' => 'l_',
+ 'include_value' => 'Y');
+
$form->header;
print $form->parse_html_template('ic/search', { %is_xyz,
my ($revers, $lastsort, $description);
+ my $cvar_configs = CVar->get_configs('module' => 'IC');
+
$form->{title} = (ucfirst $form->{searchitems}) . "s";
$form->{title} =~ s/ys$/ies/;
$form->{title} = $locale->text($form->{title});
qw(partnumber description partsgroup bin onhand rop unit listprice linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost
priceupdate weight image drawing microfiche invnumber ordnumber quonumber name serialnumber soldtotal deliverydate);
+ my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs };
+ my @searchable_custom_variables = grep { $_->{searchable} } @{ $cvar_configs };
+ my %column_defs_cvars = map { +"cvar_$_->{name}" => { 'text' => $_->{description} } } @includeable_custom_variables;
+
+ push @columns, map { "cvar_$_->{name}" } @includeable_custom_variables;
+
my %column_defs = (
'bin' => { 'text' => $locale->text('Bin'), },
'deliverydate' => { 'text' => $locale->text('deliverydate'), },
'soldtotal' => { 'text' => $locale->text('soldtotal'), },
'unit' => { 'text' => $locale->text('Unit'), },
'weight' => { 'text' => $locale->text('Weight'), },
+ %column_defs_cvars,
);
map { $column_defs{$_}->{visible} = $form->{"l_$_"} ? 1 : 0 } @columns;
map { $column_defs{$_}->{align} = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal);
- my @hidden_variables = (qw(l_subtotal l_linetotal searchitems itemstatus bom), @itemstatus_keys, @callback_keys, map { "l_$_" } @columns);
+ my @hidden_variables = (qw(l_subtotal l_linetotal searchitems itemstatus bom), @itemstatus_keys, @callback_keys, @searchable_custom_variables, map { "l_$_" } @columns);
my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
my @sort_full = qw(partnumber description onhand soldtotal deliverydate);
$report->set_sort_indicator($form->{sort}, $form->{revers} ? 0 : 1);
+ CVar->add_custom_variables_to_report('module' => 'IC',
+ 'trans_id_field' => 'id',
+ 'configs' => $cvar_configs,
+ 'column_defs' => \%column_defs,
+ 'data' => $form->{parts});
+
my @subtotal_columns = qw(sellprice listprice lastcost);
my %subtotals = map { $_ => 0 } ('onhand', @subtotal_columns);
my %totals = map { $_ => 0 } @subtotal_columns;
$form->{fokus} = "ic.partnumber";
+ $form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'IC', 'trans_id' => $form->{id});
+
+ CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}) if (scalar @{ $form->{CUSTOM_VARIABLES} });
+
$form->header;
#print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS},
# ALL_UNITS => $form->{ALL_UNITS},
'A temporary file could not be created. Please verify that the directory "#1" is writeable by the webserver.' => 'Eine temporäre Datei konnte nicht angelegt werden. Bitte stellen Sie sicher, dass das Verzeichnis "#1" vom Webserver beschrieben werden darf.',
'A temporary file could not be created:' => 'Eine temporäre Datei konnte nicht erstellt werden:',
'A unit with this name does already exist.' => 'Eine Einheit mit diesem Namen existiert bereits.',
+ 'A variable marked as \'editable\' can be changed in each quotation, order, invoice etc.' => 'Eine als \'editierbar\' markierte Variable kann in jedem Angebot, Auftrag, jeder Rechnung etc für jede Position geändert werden.',
'ADDED' => 'Hinzugefügt',
'AP' => 'Einkauf',
'AP Aging' => 'Offene Verbindlichkeiten',
'Add' => 'Erfassen',
'Add ' => 'Hinzufügen',
'Add (Customers and Vendors)' => 'Erfassen (Kunden und Lieferanten)',
+ 'Add (Parts, services, assemblies)' => 'Erfassen (Waren, Dienstleistungen, Erzeugnisse)',
'Add (Projects)' => 'Erfassen (Projekte)',
'Add AP Transaction' => 'Kreditorenbuchung',
'Add AR Transaction' => 'Debitorenbuchung',
'Customername' => 'Kundenname',
'Customernumberinit' => 'Kunden-/Lieferantennummernkreis',
'Customers' => 'Kunden',
+ 'Customers and vendors' => 'Kunden und Lieferanten',
'Customized Report' => 'Vorgewählte Zeiträume',
'DATEV - Export Assistent' => 'DATEV-Exportassistent',
'DATEV Angaben' => 'DATEV-Angaben',
'December' => 'Dezember',
'Decimalplaces' => 'Dezimalstellen',
'Decrease' => 'Verringern',
- 'Default (no language selected)' => 'Standard (keine Sprache ausgewählt)',
'Default Accounts' => 'Standardkonten',
'Default output medium' => 'Standardausgabekanal',
'Default printer' => 'Standarddrucker',
'Edit and delete a group' => 'Gruppen bearbeiten und löschen',
'Edit custom variable' => 'Benutzerdefinierte Variable bearbeiten',
'Edit file' => 'Datei bearbeiten',
- 'Edit greetings' => 'Anreden bearbeiten',
'Edit group ' => 'Gruppe bearbeiten',
'Edit group membership' => 'Gruppenmitgliedschaften bearbeiten',
'Edit groups' => 'Gruppen bearbeiten',
'Edit the sales_quotation' => 'Bearbeiten des Angebots',
'Edit the stylesheet' => 'Stilvorlage bearbeiten',
'Edit units' => 'Einheiten bearbeiten',
+ 'Editable' => 'Bearbeitbar',
'Employee' => 'Bearbeiter',
'Empty transaction!' => 'Buchung ist leer!',
'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.',
'Line Total' => 'Zeilensumme',
'Line endings' => 'Zeilenumbrüche',
'List (Customers and Vendors)' => 'Auflisten (Kunden und Lieferanten)',
+ 'List (Parts, services, assemblies)' => 'Auflisten (Waren, Dienstleistungen, Erzeugnisse)',
'List (Projects)' => 'Auflisten (Projekte)',
'List Accounting Groups' => 'Buchungsgruppen anzeigen',
'List Accounts' => 'Konten anzeigen',
'Mobile1' => 'Mobile 1',
'Mobile2' => 'Mobile 2',
'Model' => 'Lieferanten-Art-Nr.',
+ 'Module' => 'Modul',
'Module home page' => 'Modul-Webseite',
'Module name' => 'Modulname',
'Monat' => 'Monat',
'Other values are ignored.' => 'Andere Eingaben werden ignoriert.',
'Others' => 'Andere',
'Otherwise all users will only have access to their own settings.' => 'Andernfalls haben alle Benutzer nur Zugriff auf ihre Benutzereinstellungen.',
+ 'Otherwise the variable is only available for printing.' => 'Andernfalls steht die Variable nur beim Ausdruck zur Verfügung.',
'Out of balance transaction!' => 'Buchung ist nicht ausgeglichen!',
'Out of balance!' => 'Summen stimmen nicht berein!',
'Output Number Format' => 'Zahlenformat (Ausgabe)',
'Parts' => 'Waren',
'Parts Inventory' => 'Warenliste',
'Parts must have an entry type.' => 'Waren müssen eine Buchungsgruppe haben.',
+ 'Parts, services and assemblies' => 'Waren, Dienstleistungen und Erzeugnisse',
'Password' => 'Passwort',
'Payables' => 'Verbindlichkeiten',
'Payment' => 'Zahlungsausgang',
'The following users have been migrated into the authentication database:' => 'Die folgenden Benutzer wurden in die Authentifizierungsdatenbank migriert:',
'The following warnings occured during an upgrade to the document templates:' => 'Die folgenden Warnungen traten während einer Aktualisierung der Dokumentenvorlagen auf:',
'The formula needs the following syntax:<br>For regular article:<br>Variablename= Variable Unit;<br>Variablename2= Variable2 Unit2;<br>...<br>###<br>Variable + ( Variable2 / Variable )<br><b>Please be beware of the spaces in the formula</b><br>' => 'Die Formeln müssen in der folgenden Syntax eingegeben werden:<br>Bei normalen Artikeln:<br>Variablenname = Variable Einheit;<br>Variablenname2 = Variable2 Einheit2;<br>...<br>###<br>Variable + Variable2 * ( Variable - Variable2 )<br>Variablennamen und Einheiten dürfen nur aus alphanumerischen Zeichen bestehen.<br>Es muss jeweils die Gesamte Zeile eingegeben werden',
- 'The greetings have been saved.' => 'Die Anreden wurden gespeichert',
'The group has been added.' => 'Die Gruppe wurde erfasst.',
'The group has been deleted.' => 'Die Gruppe wurde gelöscht.',
'The group has been saved.' => 'Die Gruppe wurde gespeichert.',
'AR Aging' => 'Offene Forderungen',
'Accounting Menu' => 'Kontoverwaltung',
'Add (Customers and Vendors)' => 'Erfassen (Kunden und Lieferanten)',
+ 'Add (Parts, services, assemblies)' => 'Erfassen (Waren, Dienstleistungen, Erzeugnisse)',
'Add (Projects)' => 'Erfassen (Projekte)',
'Add AP Transaction' => 'Kreditorenbuchung',
'Add AR Transaction' => 'Debitorenbuchung',
'Lead' => 'Kundenquelle',
'Licenses' => 'Lizenzen',
'List (Customers and Vendors)' => 'Auflisten (Kunden und Lieferanten)',
+ 'List (Parts, services, assemblies)' => 'Auflisten (Waren, Dienstleistungen, Erzeugnisse)',
'List (Projects)' => 'Auflisten (Projekte)',
'List Accounting Groups' => 'Buchungsgruppen anzeigen',
'List Accounts' => 'Konten anzeigen',
'AR' => 'Verkauf',
'AR Aging' => 'Offene Forderungen',
'Add (Customers and Vendors)' => 'Erfassen (Kunden und Lieferanten)',
+ 'Add (Parts, services, assemblies)' => 'Erfassen (Waren, Dienstleistungen, Erzeugnisse)',
'Add (Projects)' => 'Erfassen (Projekte)',
'Add AP Transaction' => 'Kreditorenbuchung',
'Add AR Transaction' => 'Debitorenbuchung',
'Lead' => 'Kundenquelle',
'Licenses' => 'Lizenzen',
'List (Customers and Vendors)' => 'Auflisten (Kunden und Lieferanten)',
+ 'List (Parts, services, assemblies)' => 'Auflisten (Waren, Dienstleistungen, Erzeugnisse)',
'List (Projects)' => 'Auflisten (Projekte)',
'List Accounting Groups' => 'Buchungsgruppen anzeigen',
'List Accounts' => 'Konten anzeigen',
action=list_cvar_configs
cvar_module=CT
+[System--Custom Variables--Add (Parts, services, assemblies)]
+module=amcvar.pl
+action=add_cvar_config
+cvar_module=IC
+
+[System--Custom Variables--List (Parts, services, assemblies)]
+module=amcvar.pl
+action=list_cvar_configs
+cvar_module=IC
+
[System--Custom Variables--Add (Projects)]
module=amcvar.pl
action=add_cvar_config
<p>
<table>
+ <tr>
+ <td align="right">Modul</td>
+ <td>
+ [%- IF module == 'CT' %]
+ Kunden und Lieferanten
+ [%- ELSIF module == 'Projects' %]
+ Projekte
+ [%- ELSIF module == 'IC' %]
+ Waren, Dienstleistungen und Erzeugnisse
+ [%- END %]
+ </td>
+ </tr>
+
<tr>
<td align="right">Name<sup><span class="small">(1)</span></sup></td>
<td><input name="name" value="[% HTML.escape(name) %]"></td>
</select>
</td>
</tr>
+
+ [%- IF module == 'IC' %]
+ <tr>
+ <td align="right">Bearbeitbar<sup><span class="small">(5)</span></sup></td>
+ <td>
+ <input type="radio" name="flag_editable" id="flag_editable_1" value="1"[% IF flag_editable %] checked[% END %]>
+ <label for="flag_editable_1">Ja</label>
+ <input type="radio" name="flag_editable" id="flag_editable_0" value="0"[% UNLESS flag_editable %] checked[% END %]>
+ <label for="flag_editable_0">Nein</label>
+ </td>
+ </tr>
+ [%- END %]
</table>
</p>
Andere Eingaben werden ignoriert.
</p>
+ [%- IF module == 'IC' %]
+ <p>
+ (5)
+
+ Eine als 'editierbar' markierte Variable kann in jedem Angebot, Auftrag, jeder Rechnung etc für jede Position geändert werden.
+
+ Andernfalls steht die Variable nur beim Ausdruck zur Verfügung.
+ </p>
+ [%- END %]
+
</form>
</body>
<p>
<table>
+ <tr>
+ <td align="right"><translate>Module</translate></td>
+ <td>
+ [%- IF module == 'CT' %]
+ <translate>Customers and vendors</translate>
+ [%- ELSIF module == 'Projects' %]
+ <translate>Projects</translate>
+ [%- ELSIF module == 'IC' %]
+ <translate>Parts, services and assemblies</translate>
+ [%- END %]
+ </td>
+ </tr>
+
<tr>
<td align="right"><translate>Name</translate><sup><span class="small">(1)</span></sup></td>
<td><input name="name" value="[% HTML.escape(name) %]"></td>
</select>
</td>
</tr>
+
+ [%- IF module == 'IC' %]
+ <tr>
+ <td align="right"><translate>Editable</translate><sup><span class="small">(5)</span></sup></td>
+ <td>
+ <input type="radio" name="flag_editable" id="flag_editable_1" value="1"[% IF flag_editable %] checked[% END %]>
+ <label for="flag_editable_1"><translate>Yes</translate></label>
+ <input type="radio" name="flag_editable" id="flag_editable_0" value="0"[% UNLESS flag_editable %] checked[% END %]>
+ <label for="flag_editable_0"><translate>No</translate></label>
+ </td>
+ </tr>
+ [%- END %]
</table>
</p>
<translate>Other values are ignored.</translate>
</p>
+ [%- IF module == 'IC' %]
+ <p>
+ (5)
+
+ <translate>A variable marked as 'editable' can be changed in each
+ quotation, order, invoice etc.</translate>
+
+ <translate>Otherwise the variable is only available for
+ printing.</translate>
+ </p>
+ [%- END %]
+
</form>
</body>
<td class="listheading" width="20%">Typ</td>
<td class="listheading" width="20%">Durchsuchbar</td>
<td class="listheading" width="20%">In Berichten anzeigbar</td>
+ [%- IF module == 'IC' %]
+ <td class="listheading" width="20%">Bearbeitbar</td>
+ [%- END %]
</tr>
[%- FOREACH cfg = CONFIGS %]
Nein
[%- END %]
</td>
+
+ [%- IF module == 'IC' %]
+ <td>
+ [%- IF cfg.flag_editable %]
+ Ja
+ [%- ELSE %]
+ Nein
+ [%- END %]
+ </td>
+ [%- END %]
</tr>
[%- END %]
</table>
<td class="listheading" width="20%"><translate>Type</translate></td>
<td class="listheading" width="20%"><translate>Searchable</translate></td>
<td class="listheading" width="20%"><translate>Includeable in reports</translate></td>
+ [%- IF module == 'IC' %]
+ <td class="listheading" width="20%"><translate>Editable</translate></td>
+ [%- END %]
</tr>
[%- FOREACH cfg = CONFIGS %]
<translate>No</translate>
[%- END %]
</td>
+
+ [%- IF module == 'IC' %]
+ <td>
+ [%- IF cfg.flag_editable %]
+ <translate>Yes</translate>
+ [%- ELSE %]
+ <translate>No</translate>
+ [%- END %]
+ </td>
+ [%- END %]
</tr>
[%- END %]
</table>
<br style="clear: left" />
</div>
+
+[%- IF CUSTOM_VARIABLES.size %]
+<div id="custom_variables" class="tabcontent">
+
+ <p>
+ <table>
+ [%- FOREACH var = CUSTOM_VARIABLES %]
+ <tr>
+ <td align="right" valign="top">[% HTML.escape(var.description) %]</td>
+ <td valign="top">[% var.HTML_CODE %]</td>
+ </tr>
+ [%- END %]
+ </table>
+ </p>
+
+ <br style="clear: left" />
+</div>
+[%- END %]
+
</div>
<input class="submit" type="submit" name="action" value="Erneuern">
<br style="clear: left" />
</div>
+
+[%- IF CUSTOM_VARIABLES.size %]
+<div id="custom_variables" class="tabcontent">
+
+ <p>
+ <table>
+ [%- FOREACH var = CUSTOM_VARIABLES %]
+ <tr>
+ <td align="right" valign="top">[% HTML.escape(var.description) %]</td>
+ <td valign="top">[% var.HTML_CODE %]</td>
+ </tr>
+ [%- END %]
+ </table>
+ </p>
+
+ <br style="clear: left" />
+</div>
+[%- END %]
+
</div>
<input class="submit" type="submit" name="action" value="<translate>Update</translate>">
<ul id="maintab" class="shadetabs">
<li class="selected"><a href="#" rel="master_data">Stammdaten</a></li>
+ [%- IF CUSTOM_VARIABLES.size %]
+ <li><a href="#" rel="custom_variables">Benutzerdefinierte Variablen</a></li>
+ [%- END %]
</ul>
<div class="tabcontentstyle">
<ul id="maintab" class="shadetabs">
<li class="selected"><a href="#" rel="master_data"><translate>Master Data</translate></a></li>
+ [%- IF CUSTOM_VARIABLES.size %]
+ <li><a href="#" rel="custom_variables"><translate>Custom Variables</translate></a></li>
+ [%- END %]
</ul>
<div class="tabcontentstyle">
<td><input name="microfiche" size="20"></td>
</tr>
+ [% CUSTOM_VARIABLES_FILTER_CODE %]
+
[%- IF is_assembly %]
<tr>
<td></td>
<td>
</td>
</tr>
+
+ [% CUSTOM_VARIABLES_INCLUSION_CODE %]
</table>
</td>
</tr>
<td><input name="microfiche" size="20"></td>
</tr>
+ [% CUSTOM_VARIABLES_FILTER_CODE %]
+
[%- IF is_assembly %]
<tr>
<td></td>
<td>
</td>
</tr>
+
+ [% CUSTOM_VARIABLES_INCLUSION_CODE %]
</table>
</td>
</tr>