import tax data
This commit is contained in:
parent
2acdf7ea4e
commit
ff3a650cc7
2 changed files with 38 additions and 5 deletions
|
|
@ -395,8 +395,8 @@ sub www_getTaxesAsJson {
|
||||||
return $session->privilege->insufficient
|
return $session->privilege->insufficient
|
||||||
unless $admin->canManage;
|
unless $admin->canManage;
|
||||||
my ($db, $form) = $session->quick(qw(db form));
|
my ($db, $form) = $session->quick(qw(db form));
|
||||||
my $startIndex = $form->get('startIndex') || 0;
|
my $startIndex = $form->get('startIndex') || 0;
|
||||||
my $numberOfResults = $form->get('results') || 25;
|
my $numberOfResults = $form->get('results') || 25;
|
||||||
my @placeholders = ();
|
my @placeholders = ();
|
||||||
my $sql = 'select SQL_CALC_FOUND_ROWS * from tax';
|
my $sql = 'select SQL_CALC_FOUND_ROWS * from tax';
|
||||||
my $keywords = $form->get("keywords");
|
my $keywords = $form->get("keywords");
|
||||||
|
|
@ -425,6 +425,27 @@ sub www_getTaxesAsJson {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 www_importTax ( )
|
||||||
|
|
||||||
|
Import new tax data from a file provided by the user. This will replace the current
|
||||||
|
data with the new data.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub www_importTax {
|
||||||
|
my $self = shift;
|
||||||
|
my $session = $self->session;
|
||||||
|
my $admin = WebGUI::Shop::Admin->new($session);
|
||||||
|
return $session->privilege->insufficient
|
||||||
|
unless $admin->canManage;
|
||||||
|
my $storage = WebGUI::Storage->create($session);
|
||||||
|
my $taxFile = $storage->addFileFromFormPost('importFile', 1);
|
||||||
|
$self->importTaxData($storage->getPath($taxFile)) if $taxFile;
|
||||||
|
return $self->www_manage;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 www_manage ( )
|
=head2 www_manage ( )
|
||||||
|
|
||||||
User interface to manage taxes. Provides a list of current taxes, and forms for adding
|
User interface to manage taxes. Provides a list of current taxes, and forms for adding
|
||||||
|
|
@ -451,13 +472,19 @@ sub www_manage {
|
||||||
$style->setRawHeadTags('<style type="text/css"> #paging a { color: #0000de; } #search, #export form { display: inline; } </style>');
|
$style->setRawHeadTags('<style type="text/css"> #paging a { color: #0000de; } #search, #export form { display: inline; } </style>');
|
||||||
my $i18n=WebGUI::International->new($session, 'Tax');
|
my $i18n=WebGUI::International->new($session, 'Tax');
|
||||||
|
|
||||||
my $exportForm = WebGUI::Form::formHeader($session,{action => $url->page('shop=tax;method=exportTax')}).WebGUI::Form::submit($session,{value=>$i18n->get('export')}).WebGUI::Form::formFooter($session);
|
my $exportForm = WebGUI::Form::formHeader($session,{action => $url->page('shop=tax;method=exportTax')})
|
||||||
my $output =sprintf <<EODIV, $i18n->get(364, 'WebGUI'), $exportForm;
|
. WebGUI::Form::submit($session,{value=>$i18n->get('export')})
|
||||||
|
. WebGUI::Form::formFooter($session);
|
||||||
|
my $importForm = WebGUI::Form::formHeader($session,{action => $url->page('shop=tax;method=importTax')})
|
||||||
|
. q{<input type="file" name="importFile" size="10" />}
|
||||||
|
. WebGUI::Form::submit($session,{value=>$i18n->get('import')})
|
||||||
|
. WebGUI::Form::formFooter($session);
|
||||||
|
my $output =sprintf <<EODIV, $i18n->get(364, 'WebGUI'), $importForm, $exportForm;
|
||||||
<div class=" yui-skin-sam">
|
<div class=" yui-skin-sam">
|
||||||
<div id="search"><form id="keywordSearchForm"><input type="text" name="keywords" id="keywordsField" /><input type="submit" value="%s" /></form></div>
|
<div id="search"><form id="keywordSearchForm"><input type="text" name="keywords" id="keywordsField" /><input type="submit" value="%s" /></form></div>
|
||||||
<div id="paging"></div>
|
<div id="paging"></div>
|
||||||
<div id="dt"></div>
|
<div id="dt"></div>
|
||||||
<div id="import"></div>
|
<div id="import">%s</div>
|
||||||
<div id="export">%s</div>
|
<div id="export">%s</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,12 @@ our $I18N = {
|
||||||
context => q|To ship a copy of the tax data out of the server.|,
|
context => q|To ship a copy of the tax data out of the server.|,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'import' => {
|
||||||
|
message => q|Import|,
|
||||||
|
lastUpdated => 1206390280,
|
||||||
|
context => q|To bring in new tax data that replaces the current data.|,
|
||||||
|
},
|
||||||
|
|
||||||
'delete' => {
|
'delete' => {
|
||||||
message => q|delete|,
|
message => q|delete|,
|
||||||
lastUpdated => 1206385749,
|
lastUpdated => 1206385749,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue