Skip to content

Commit

Permalink
inovice upload + related product in stock
Browse files Browse the repository at this point in the history
  • Loading branch information
leedavi committed Apr 20, 2021
1 parent 85b476d commit ce09324
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
17 changes: 15 additions & 2 deletions Components/Orders/OrderFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ private static String OrderAdminSave(HttpContext context)
{
var fname = Path.GetFileName(ajaxInfo.GetXmlProperty("genxml/hidden/optionfilelist"));

var ext = Path.GetExtension(fname);
fname = DnnUtils.Encrypt(fname, StoreSettings.Current.Get("adminpin"));
foreach (char c in System.IO.Path.GetInvalidFileNameChars())
{
fname = fname.Replace(c, '_');
}
fname = ext + "-" + fname; // add extension to front, so it cannot be servered but we can add to order data.

if (File.Exists(StoreSettings.Current.FolderTempMapPath.TrimEnd('\\') + "\\" + fname))
{
var newfname = "secure" + Utils.GetUniqueKey();
Expand All @@ -229,9 +237,14 @@ private static String OrderAdminSave(HttpContext context)
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefilepath", StoreSettings.Current.FolderUploadsMapPath.TrimEnd('\\') + "\\" + newfname);
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefilename", newfname);
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoiceuploadname", fname);
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefileext", Path.GetExtension(fname));

var ext2 = "";
var extSplit = fname.Split('-');
if (extSplit.Count() > 0) ext2 = extSplit[0]; // we add the extension to the front of upload for IIS default security in serving file.

ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefileext", ext2);
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefilerelpath", StoreSettings.Current.FolderUploads + "/" + newfname);
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicedownloadname", "NBS" + ordData.OrderNumber + Path.GetExtension(fname));
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicedownloadname", "OS" + ordData.OrderNumber + ext2);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.1.5.1")]
[assembly: AssemblyFileVersion("4.1.5.1")]
[assembly: AssemblyVersion("4.1.5.2")]
[assembly: AssemblyFileVersion("4.1.5.2")]
8 changes: 4 additions & 4 deletions Themes/ClassicAjax/Default/ProductDisplayDetail.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ else

<div class="price">

@if (product.Models.Count > 1)
@if (rproduct.Models.Count > 1)
{
<span class="from">@ResourceKey("ProductView.from")</span>
}

@if (product.IsOnSale)
@if (rproduct.IsOnSale)
{
<span class="old">@(NBrightBuyUtils.FormatToStoreCurrency(rproduct.FromPrice()))</span>
<span class="sale">@(NBrightBuyUtils.FormatToStoreCurrency(rproduct.BestPrice()))</span>
Expand All @@ -317,11 +317,11 @@ else
</div>

<div class="flags">
@if (product.IsOnSale)
@if (rproduct.IsOnSale)
{
<span class="onsaleflag">@ResourceKey("ProductView.onsaleflag")</span>
}
@if (!product.IsInStock)
@if (!rproduct.IsInStock)
{
<span class="outofstockflag">@ResourceKey("ProductView.outofstockflag")</span>
}
Expand Down
2 changes: 1 addition & 1 deletion Themes/Default/Default/OrderAdminDetail.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@if (nbi.GetXmlProperty("genxml/hidden/invoicefilename") != "")
{
<a class="documentlink btn btn-default primarybutton" href='/DesktopModules/NBright/NBrightBuy/XmlConnector.ashx?cmd=docdownload&[email protected]("genxml/hidden/invoicedownloadname")&[email protected]("genxml/hidden/invoicefilerelpath")'>@ResourceKey("OrderAdmin.downloadinvoice")</a>
<a class="documentlink btn btn-default primarybutton" href='/DesktopModules/NBright/NBrightBuy/XmlConnector.ashx?cmd=docdownload&[email protected]("genxml/hidden/invoicedownloadname")&[email protected]&[email protected]("genxml/hidden/invoicefilerelpath")'>@ResourceKey("OrderAdmin.downloadinvoice")</a>
}
</div>

Expand Down
7 changes: 5 additions & 2 deletions XmlConnector.ashx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,14 @@ private string DownloadSystemFile(string paramCmd, HttpContext context)
{
strOut = fname; // return this is error.
var downloadname = Utils.RequestQueryStringParam(context, "downloadname");
var userid = Utils.RequestQueryStringParam(context, "userid");
var fpath = HttpContext.Current.Server.MapPath(fname);
if (downloadname == "") downloadname = Path.GetFileName(fname);
try
{
if (fpath.ToLower().Contains("\\secure"))
{
if (NBrightBuyUtils.CheckManagerRights())
if (NBrightBuyUtils.CheckManagerRights() || UserController.Instance.GetCurrentUserInfo().UserID.ToString() == userid)
{
Utils.ForceDocDownload(fpath, downloadname, context.Response);
}
Expand Down Expand Up @@ -487,12 +488,14 @@ private String UploadWholeFile(HttpContext context, List<FilesStatus> statuses,
Regex fexpr = new Regex(StoreSettings.Current.Get("fileregexpr"));
if (fexpr.Match(file.FileName.ToLower()).Success)
{
var ext = Path.GetExtension(file.FileName);
var fn = DnnUtils.Encrypt(file.FileName, StoreSettings.Current.Get("adminpin"));
foreach (char c in System.IO.Path.GetInvalidFileNameChars())
{
fn = fn.Replace(c, '_');
}
file.SaveAs(StoreSettings.Current.FolderTempMapPath + "\\" + fn);
fn = ext + "-" + fn; // add extension to front, so it cannot be servered but we can add to order data.
file.SaveAs(StoreSettings.Current.FolderTempMapPath + "\\" + fn);
statuses.Add(new FilesStatus(Path.GetFileName(fn), file.ContentLength));
}
}
Expand Down

0 comments on commit ce09324

Please sign in to comment.