Hello. I just opened a feature request (#2464) for a robust solution to this, but in the meantime I'd like to throw my own little hack together.
Unfortunately, the parameter "command" is a string that I'd like to be able to manipulate, but I tried to follow Dr. Sparks' pattern for this situation below.
Code: Select all
public static List<Payment> GetForDeposit(DateTime dateStart,long clinicNum,List<long> payTypes) {
if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
return Meth.GetObject<List <Payment>>(MethodBase.GetCurrentMethod(),dateStart,clinicNum,payTypes);
}
string command=
"SELECT * FROM payment "
+"WHERE DepositNum = 0 "
+"AND PayDate >= "+POut.Date(dateStart)+" ";
if(clinicNum!=0){
command+="AND ClinicNum="+POut.Long(clinicNum);
}
for(int i=0;i<payTypes.Count;i++) {
if(i==0) {
command+=" AND (";
}
else {
command+=" OR ";
}
command+="PayType="+POut.Long(payTypes[i]);
if(i==payTypes.Count-1) {
command+=")";
}
}
command+=" ORDER BY PayDate";
//BEGIN NEW HOOK HERE PLEASE :) SOMETHING LIKE...
object[] parameters={command};
Plugins.HookAddCode(null, "Payments.GetForDeposit_beforequeryrun", parameters);
command=(string)parameters[0];
//END NEW HOOK HERE PLEASE :)
return Crud.PaymentCrud.SelectMany(command);
}
Al