Skip to content

Commit

Permalink
预约到书通知,默认情况下不再会使用 sms 类型。需要在 arrived 元素的 notifyTypes 属性中明确定义才行。
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalPlatform committed Apr 19, 2016
1 parent eb93222 commit bcd8a73
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
9 changes: 8 additions & 1 deletion DigitalPlatform.LibraryServer/AppCirculation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3819,6 +3819,12 @@ public LibraryServerResult Return(

string strReaderBarcode = strReaderBarcodeParam;

if (strAction == "read" && string.IsNullOrEmpty(strReaderBarcode))
{
strError = "读过功能 strReaderBarcode 参数值不应为空";
goto ERROR1;
}

string strBatchNo = "";
if (strAction == "inventory")
{
Expand Down Expand Up @@ -4763,7 +4769,8 @@ public LibraryServerResult Return(

DateTime start_time_process = DateTime.Now;

string strReaderName = DomUtil.GetElementText(readerdom.DocumentElement, "name");
string strReaderName = readerdom == null ? "" :
DomUtil.GetElementText(readerdom.DocumentElement, "name");

if (bDelayVerifyReaderBarcode == true)
{
Expand Down
15 changes: 8 additions & 7 deletions DigitalPlatform.LibraryServer/AppReservation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ public LibraryServerResult Reservation(
if (bArrived == true)
ArriveItemBarcodes.Add(strItemBarcode);


// 写回册记录
lRet = channel.DoSaveTextRes(strOutputItemRecPath,
itemdom.OuterXml,
Expand All @@ -425,14 +424,11 @@ public LibraryServerResult Reservation(
// 即把刚才增加的<request>元素找到后删除
goto ERROR1;
}


}
finally
{
this.EntityLocks.UnlockForWrite(strItemBarcode);
}

} // end of for

// 在读者记录中加入或删除预约信息
Expand Down Expand Up @@ -1729,12 +1725,12 @@ int AddNotifyRecordToQueue(
}
#endif


// 发送短消息通知
string strTotalError = "";

// *** dpmail
if (this.MessageCenter != null)
if (this.MessageCenter != null
&& StringUtil.IsInList("dpmail", this.ArrivedNotifyTypes))
{
string strTemplate = "";
// 获得邮件模板
Expand Down Expand Up @@ -1796,7 +1792,8 @@ int AddNotifyRecordToQueue(
}

// ** email
if (String.IsNullOrEmpty(strReaderEmailAddress) == false)
if (String.IsNullOrEmpty(strReaderEmailAddress) == false
&& StringUtil.IsInList("email", this.ArrivedNotifyTypes))
{
string strTemplate = "";
// 获得邮件模板
Expand Down Expand Up @@ -1861,6 +1858,10 @@ int AddNotifyRecordToQueue(
{
foreach (MessageInterface message_interface in this.m_externalMessageInterfaces)
{
// types
if (StringUtil.IsInList(message_interface.Type, this.ArrivedNotifyTypes) == false)
continue;

string strTemplate = "";
// 获得邮件模板
nRet = GetMailTemplate(
Expand Down
9 changes: 8 additions & 1 deletion DigitalPlatform.LibraryServer/BatchTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,14 @@ public virtual void ThreadMain()
finally
{
// 2009/7/16 移动到这里
eventFinished.Set();
try
{
eventFinished.Set();
}
catch(ObjectDisposedException) // 2016/4/19
{

}

// 2009/7/16 新增
this.m_bClosed = true;
Expand Down
18 changes: 14 additions & 4 deletions DigitalPlatform.LibraryServer/LibraryApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ public string Function
public int OutofReservationThreshold = 10; // 预约到书多少不取次后,被惩罚禁止预约
public bool CanReserveOnshelf = true; // 是否可以预约在架图书
public string NotifyDef = ""; // 提醒通知的定义。"15day,50%,70%"
public string ArrivedNotifyTypes = "dpmail,email"; // 到书通知的类型

DefaultThread defaultManagerThread = null; // 缺省管理后台任务

Expand Down Expand Up @@ -744,7 +745,7 @@ public int LoadCfg(

// 预约到书
// 元素<arrived>
// 属性dbname/reserveTimeSpan/outofReservationThreshold/canReserveOnshelf
// 属性dbname/reserveTimeSpan/outofReservationThreshold/canReserveOnshelf/notifyTypes
node = dom.DocumentElement.SelectSingleNode("arrived") as XmlElement;
if (node != null)
{
Expand Down Expand Up @@ -778,13 +779,21 @@ public int LoadCfg(
}

app.CanReserveOnshelf = bValue;

// 没有这个属性的时候,默认 "dpmail,email",否则依其值,哪怕为 ""
if (node.GetAttributeNode("notifyTypes") == null)
app.ArrivedNotifyTypes = "dpmail,email";
else
app.ArrivedNotifyTypes = node.GetAttribute("notifyTypes");

}
else
{
app.ArrivedDbName = "";
app.ArrivedReserveTimeSpan = "";
app.OutofReservationThreshold = 10;
app.CanReserveOnshelf = true;
app.ArrivedNotifyTypes = "dpmail,email";
}

// 2013/9/24
Expand Down Expand Up @@ -2981,6 +2990,7 @@ public void Save(string strFileName,
// 2007/11/5
writer.WriteAttributeString("outofReservationThreshold", this.OutofReservationThreshold.ToString());
writer.WriteAttributeString("canReserveOnshelf", this.CanReserveOnshelf == true ? "true" : "false");
writer.WriteAttributeString("notifyTypes", this.ArrivedNotifyTypes);

writer.WriteEndElement();

Expand Down Expand Up @@ -8905,7 +8915,7 @@ public int ResetPassword(

// 观察 password 元素的 lastResetTime 属性,需在规定的时间长度以外才能再次进行重设

string strBarcode = DomUtil.GetElementText(readerdom.DocumentElement, "barcode");
string strBarcode = DomUtil.GetElementText(readerdom.DocumentElement, "barcode");
{
string strPrefix = "";
string strValue = "";
Expand All @@ -8929,11 +8939,11 @@ public int ResetPassword(
string strEmail = DomUtil.GetElementText(readerdom.DocumentElement, "email");
if (StringUtil.SplitList(strEmail).IndexOf(strValue) == -1)
{
strError = "地址 '"+strValue+"' 不匹配";
strError = "地址 '" + strValue + "' 不匹配";
return -1;
}
}
if (strPrefix == "TP:")
if (strPrefix == "TP:")
{
// 核对 电话号码
string strTel1 = DomUtil.GetElementText(readerdom.DocumentElement, "tel");
Expand Down

0 comments on commit bcd8a73

Please sign in to comment.