Skip to content

Commit ce09324

Browse files
committed
inovice upload + related product in stock
1 parent 85b476d commit ce09324

File tree

5 files changed

+27
-11
lines changed

5 files changed

+27
-11
lines changed

Components/Orders/OrderFunctions.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,14 @@ private static String OrderAdminSave(HttpContext context)
214214
{
215215
var fname = Path.GetFileName(ajaxInfo.GetXmlProperty("genxml/hidden/optionfilelist"));
216216

217+
var ext = Path.GetExtension(fname);
218+
fname = DnnUtils.Encrypt(fname, StoreSettings.Current.Get("adminpin"));
219+
foreach (char c in System.IO.Path.GetInvalidFileNameChars())
220+
{
221+
fname = fname.Replace(c, '_');
222+
}
223+
fname = ext + "-" + fname; // add extension to front, so it cannot be servered but we can add to order data.
224+
217225
if (File.Exists(StoreSettings.Current.FolderTempMapPath.TrimEnd('\\') + "\\" + fname))
218226
{
219227
var newfname = "secure" + Utils.GetUniqueKey();
@@ -229,9 +237,14 @@ private static String OrderAdminSave(HttpContext context)
229237
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefilepath", StoreSettings.Current.FolderUploadsMapPath.TrimEnd('\\') + "\\" + newfname);
230238
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefilename", newfname);
231239
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoiceuploadname", fname);
232-
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefileext", Path.GetExtension(fname));
240+
241+
var ext2 = "";
242+
var extSplit = fname.Split('-');
243+
if (extSplit.Count() > 0) ext2 = extSplit[0]; // we add the extension to the front of upload for IIS default security in serving file.
244+
245+
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefileext", ext2);
233246
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicefilerelpath", StoreSettings.Current.FolderUploads + "/" + newfname);
234-
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicedownloadname", "NBS" + ordData.OrderNumber + Path.GetExtension(fname));
247+
ordData.PurchaseInfo.SetXmlProperty("genxml/hidden/invoicedownloadname", "OS" + ordData.OrderNumber + ext2);
235248
}
236249
}
237250

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("4.1.5.1")]
36-
[assembly: AssemblyFileVersion("4.1.5.1")]
35+
[assembly: AssemblyVersion("4.1.5.2")]
36+
[assembly: AssemblyFileVersion("4.1.5.2")]

Themes/ClassicAjax/Default/ProductDisplayDetail.cshtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,12 @@ else
300300

301301
<div class="price">
302302

303-
@if (product.Models.Count > 1)
303+
@if (rproduct.Models.Count > 1)
304304
{
305305
<span class="from">@ResourceKey("ProductView.from")</span>
306306
}
307307

308-
@if (product.IsOnSale)
308+
@if (rproduct.IsOnSale)
309309
{
310310
<span class="old">@(NBrightBuyUtils.FormatToStoreCurrency(rproduct.FromPrice()))</span>
311311
<span class="sale">@(NBrightBuyUtils.FormatToStoreCurrency(rproduct.BestPrice()))</span>
@@ -317,11 +317,11 @@ else
317317
</div>
318318

319319
<div class="flags">
320-
@if (product.IsOnSale)
320+
@if (rproduct.IsOnSale)
321321
{
322322
<span class="onsaleflag">@ResourceKey("ProductView.onsaleflag")</span>
323323
}
324-
@if (!product.IsInStock)
324+
@if (!rproduct.IsInStock)
325325
{
326326
<span class="outofstockflag">@ResourceKey("ProductView.outofstockflag")</span>
327327
}

Themes/Default/Default/OrderAdminDetail.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
@if (nbi.GetXmlProperty("genxml/hidden/invoicefilename") != "")
2828
{
29-
<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>
29+
<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>
3030
}
3131
</div>
3232

XmlConnector.ashx.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,14 @@ private string DownloadSystemFile(string paramCmd, HttpContext context)
287287
{
288288
strOut = fname; // return this is error.
289289
var downloadname = Utils.RequestQueryStringParam(context, "downloadname");
290+
var userid = Utils.RequestQueryStringParam(context, "userid");
290291
var fpath = HttpContext.Current.Server.MapPath(fname);
291292
if (downloadname == "") downloadname = Path.GetFileName(fname);
292293
try
293294
{
294295
if (fpath.ToLower().Contains("\\secure"))
295296
{
296-
if (NBrightBuyUtils.CheckManagerRights())
297+
if (NBrightBuyUtils.CheckManagerRights() || UserController.Instance.GetCurrentUserInfo().UserID.ToString() == userid)
297298
{
298299
Utils.ForceDocDownload(fpath, downloadname, context.Response);
299300
}
@@ -487,12 +488,14 @@ private String UploadWholeFile(HttpContext context, List<FilesStatus> statuses,
487488
Regex fexpr = new Regex(StoreSettings.Current.Get("fileregexpr"));
488489
if (fexpr.Match(file.FileName.ToLower()).Success)
489490
{
491+
var ext = Path.GetExtension(file.FileName);
490492
var fn = DnnUtils.Encrypt(file.FileName, StoreSettings.Current.Get("adminpin"));
491493
foreach (char c in System.IO.Path.GetInvalidFileNameChars())
492494
{
493495
fn = fn.Replace(c, '_');
494496
}
495-
file.SaveAs(StoreSettings.Current.FolderTempMapPath + "\\" + fn);
497+
fn = ext + "-" + fn; // add extension to front, so it cannot be servered but we can add to order data.
498+
file.SaveAs(StoreSettings.Current.FolderTempMapPath + "\\" + fn);
496499
statuses.Add(new FilesStatus(Path.GetFileName(fn), file.ContentLength));
497500
}
498501
}

0 commit comments

Comments
 (0)