-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return item request should generate RMA #24
- Loading branch information
Dmitry Chmir
committed
Jun 21, 2016
1 parent
d1ab5db
commit c90f07e
Showing
24 changed files
with
245 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/Libraries/Nop.Services/Orders/CustomNumberFormatter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
//using System; | ||
//using System.Text.RegularExpressions; | ||
using Nop.Core.Domain.Orders; | ||
|
||
namespace Nop.Services.Orders | ||
{ | ||
public partial class CustomNumberFormatter : ICustomNumberFormatter | ||
{ | ||
#region Fields | ||
|
||
private OrderSettings _orderSettings; | ||
|
||
#endregion | ||
|
||
#region Ctor | ||
|
||
public CustomNumberFormatter(OrderSettings orderSettings) | ||
{ | ||
_orderSettings = orderSettings; | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
public virtual string GenerateReturnRequestCustomNumber(ReturnRequest returnRequest) | ||
{ | ||
var customNumber = string.Empty; | ||
|
||
if (string.IsNullOrEmpty(_orderSettings.ReturnRequestNumberMask)) | ||
{ | ||
customNumber = returnRequest.Id.ToString(); | ||
} | ||
else | ||
{ | ||
customNumber = _orderSettings.ReturnRequestNumberMask | ||
.Replace("{ID}", returnRequest.Id.ToString()) | ||
.Replace("{YYYY}", returnRequest.CreatedOnUtc.ToString("yyyy")) | ||
.Replace("{YY}", returnRequest.CreatedOnUtc.ToString("yy")) | ||
.Replace("{MM}", returnRequest.CreatedOnUtc.ToString("MM")) | ||
.Replace("{DD}", returnRequest.CreatedOnUtc.ToString("dd")); | ||
|
||
//if you need to use the format for the ID with leading zeros, use the following code instead of the previous one. | ||
////mask for Id example {#:00000000} | ||
//var rgx = new Regex(@"{#:\d+}"); | ||
//var match = rgx.Match(customNumber); | ||
//var maskForReplase = match.Value; | ||
// | ||
//rgx = new Regex(@"\d+"); | ||
//match = rgx.Match(maskForReplase); | ||
// | ||
//var formatValue = match.Value; | ||
//if(!string.IsNullOrEmpty(formatValue) && !string.IsNullOrEmpty(maskForReplase)) | ||
// customNumber = customNumber.Replace(maskForReplase, returnRequest.Id.ToString(formatValue)); | ||
//else | ||
// customNumber = customNumber.Insert(0, string.Format("{0}-", returnRequest.Id)); | ||
} | ||
|
||
return customNumber; | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Nop.Core.Domain.Orders; | ||
|
||
namespace Nop.Services.Orders | ||
{ | ||
public partial interface ICustomNumberFormatter | ||
{ | ||
string GenerateReturnRequestCustomNumber(ReturnRequest returnRequest); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.