1 <& elements/browse.html,
2 'title' => 'Invoice modes',
3 'name_singular' => 'configuration',
4 'menubar' => \@menubar,
7 'table' => 'invoice_conf',
8 'addl_from' => ' JOIN invoice_mode USING (modenum)',
9 'extra_sql' => ' WHERE '.$curuser->agentnums_sql(
10 'table' => 'invoice_mode',
11 'null_right' => ['Edit global templates'],
13 'order_by' => q( ORDER BY modename asc, COALESCE(locale,'') asc),
15 'count_query' => 'SELECT COUNT(*) FROM invoice_conf JOIN invoice_mode USING (modenum)',
16 'header' => [ 'Name', 'Agent', 'Locale', 'Overrides', ],
17 'fields' => [ $modename,
23 'links' => [ '', '', $link ],
24 'disable_maxselect' => 1,
28 my $curuser = $FS::CurrentUser::CurrentUser;
31 unless $curuser->access_right([ 'View templates', 'View global templates',
32 'Edit templates', 'Edit global templates', ]);
34 my @overrides = grep {$_ ne 'modenum' and $_ ne 'confnum'} FS::invoice_conf->fields;
35 my $select = join(',', 'modename', 'agentnum', 'confnum', 'invoice_conf.*');
38 if ( $curuser->access_right(['Edit templates', 'Edit global templates']) ) {
39 push @menubar, 'Add a new invoice mode' => $p.'edit/invoice_conf.html';
42 my $locale_style = 'font-size:0.8em; padding:3px; background-color:';
46 return '' if $_[0]->modenum == $last_modenum;
51 return '' if $_[0]->modenum == $last_modenum;
52 $last_modenum = $_[0]->modenum;
53 $_[0]->agentnum ? FS::agent->by_key($_[0]->agentnum)->agent : '(global)';
56 my $locale_label = sub {
57 my $l = $_[0]->locale;
58 ($l ? +{ FS::Locales->locale_info($l) }->{'label'} : 'default') .
59 '<br><font size="-1">('.mt('edit').')</font>'
63 my $invoice_conf = shift;
64 [ map { [ { data => $_ } ] }
65 grep { length $invoice_conf->get($_) }
70 my $link = [ $p.'edit/invoice_conf.html?', 'confnum' ];