sprintf not entering info into database - printf

Wondering if someone can help figure out why this code is not entering all info into database. it only enters an id, newuser_id and a siteid after coming back from paypal. It refuses to enter anything else.
Is there any code to replace this sprint crap? I don't know what else to do or try or how to test where it fails.
$sql = sprintf('INSERT INTO turnkeys_paypal_data values(NULL,\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',%d,\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',\'%s\',%0.2f,%d,%d,%d)',
$_POST['address_status'],
$_POST['payer_id'],
$_POST['address_street'],
$_POST['payment_date'],
$_POST['address_zip'],
$_POST['first_name'],
$_POST['address_country'],
$_POST['address_city'],
$_POST['quantity'],
$_POST['payer_email'],
$_POST['verify_sign'],
$_POST['last_name'],
$_POST['address_state'],
$_POST['txn_id'],
$_POST['receiver_id'],
$_POST['item_name'],
$_POST['item_number'],
$_POST['payment_gross'],
$_SESSION['newuser_id'],
$_SESSION['refer_id'],
$siteid );

Related

How to correctly add a labor transaction record in a Maximo automation script

Hi I'm trying to add a labor transaction from an action automation script with the object being ASSIGNMENT in Maximo. I am currently trying the code below.
labTransSet = MXServer.getMXServer().getMboSet("LABTRANS",ui);
labTrans = labTransSet.add();
labTrans.setValue("laborcode", userLabor);
labTrans.setValue("wonum", assignWonum);
sds1=SimpleDateFormat("hh.mm aa").format(firstDate);
sds2=SimpleDateFormat("hh.mm aa").format(Date());
labTrans.setValue("STARTTIME", sds1);
labTrans.setValue("FINISHTIME", sds2);
labTransSet.save();
labTransSet.close();
userLabor is the username of the current user
assignWonum is the assignment work order number
firstDate is the scheduled date field from the assignment
The labor record is being added correctly with the right data, but when I go to route my workflow after the script is called from a button, I am given the warning BMXAA8229W WOACTIVITY has been updated by another user and the work order does not route. I am under the impression that this is happening because the assignment object for the script is being queried at the same time I try to add and save a labor record. Does anyone know if my guess is correct or what else the problem is and how I can fix this? Thanks
That error occurs because Maximo already has one version of the record loaded into memory when the record in the database is modified independently. Maximo then tries to work with the in-memory object and sees it doesn't match what is in the database and throws that error. Timing doesn't really have anything to do with it (other than that an edit happened at some point after the record was loaded into memory).
What you need to do is make sure you are modifying the exact same task/assignment/labtrans record that has already been loaded into memory. That "MXServer.getMXServer().getMboSet" stuff is guaranteed to use a new object. That is how you start a new transaction in Maximo; how you make sure you are not using anything already loaded into memory. I suspect you want to get your set off of the implicit "mbo" object the script will give to you.

SSRS data driven subscription error

I have a data driven subscription with 71 parameters. Every-time I run my subscription I get 5 errors and 71 of 71 processed with 5 errors. But when I count my report only 66 reports have been created. I tried to check the log but couldn't find any errors other than at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run(ContextBody callback)
at Microsoft.ReportingServices.Diagnostics.ExtensionClassFactory.CreateExtensionObject(Extension extConfig, Boolean typeOnly).
library!ReportServer_0-43!3b10!11/10/2015-11:46:20:: i INFO: Call to GetSystemPropertiesAction().
library!ReportServer_0-43!411c!11/10/2015-11:46:20:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.LogonFailedException: Logon attempt for user 'user' failed., Microsoft.ReportingServices.Diagnostics.Utilities.LogonFailedException: Log on failed. Ensure the user name and password are correct. ---> System.ComponentModel.Win32Exception: The user name or password is incorrect
at Microsoft.ReportingServices.Diagnostics.Utilities.LoginUtil.Login(String userName, IntPtr ptrPwd, String domain)
at Microsoft.ReportingServices.Diagnostics.Utilities.LoginUtil.Login(String userName, SecureStringWrapper userPwd, String domain)
at Microsoft.ReportingServices.Diagnostics.ImpersonationContext..ctor(String userName, SecureStringWrapper password, String domain)
--- End of inner exception stack trace ---;
Am I missing something,not reading the log properly? any help is appreciated. Thanks in advance!
To identify which logs are failing, you can view the report server's execution logs:
Use ReportServer
select * from ExecutionLog order by TimeStart DESC
The 'ReportID' field can be looked up in the reportserver's 'catalog' table. I find that having an SSRS report set up that queries this is invaluable.
Once you identify the reports that are failing (via the above queries) then you can try running them manually, to see if they work. If they do work, then set up a subscription for just those reports, and see if they work when run as a subscription.
If you've never had a problem with these before, my bet is that the datasources use pass-through authentication, which works when logged in, but not when run automatically.
Let us know how you get on!

MB_CREATE_GOODS_MOVEMENT returns subrc = 5 when running BAPI_GOODSMVT_CREATE

Using me21n to do a returns purchase order (credit) we are getting a pretty uninformative error text in the return table when creating a MIGO entry. This is an enhanced step on the user exit. BAPI_GOODSMVT_CREATE returns;
1, E, WRF_CONS, 010, No data available, , 000000, , , , , GOODSMVT_ITEM, 1, , RPECLNT500
I have attempted to debug further as 'No data available' doesn't mean a whole lot to me. I noticed MB_CREATE_GOODS_MOVEMENT returned a subrc of 5 in the EMKPF structure. Not sure if i have gone off on a tangent here or not... Its pretty darned heavy going in there.
Anyway the create MIGO step is only giving the above return error for a particular vendor code. When we use the exact same data with the exception of Vendor code and Info Record (which populates automatically via the vendor selection) the MIGO step is successful. Any suggestions?
Thanks for the help
Ok this is resolved. We had to add partner LF into Site A302 for Vendor profile. Then add the STO details in SPRO. Huzar for config....

UKHost4U and MySQL - How to connect?

been waiting an hour to find out correct way to connect to mysql at UKHOST4U, thought someone on here may know?
Been using the following code, database, user & password are all setup correctly:
$hostn='localhost';
$dbn='cpanel1_dbname';
$passn='password';
$usern='cpanel1_usrname';
$dbh = #mysqli_connect($hostn, $usern, $passn, $dbn);
if(!$dbh)
die('hmm that did not seem to work; please try another day..');
I have obvioulsy changed the actual values.
I have just moved to UKHost4U - Am I missing something?!
I had to contact them and 'then it worked' as per normal..

Transaction inside of code

I'm having an issue where I'm preaty not sure how to resolve this and I want to know what is the best approach I should consider in order to achieve this task.
We are developping an application VB.net 2.0 and SQL 2005. Users are allowed to cancel a reception based on a purchase which may contains many received goods. But, during the process of cancellation, some questions are asked to users such as "Do you want to cancel Good #1". If yes, delete. Then, "Do you want to cancel Good #2", no, do not delete and one another question (if received item is issued, a process must be made manualy by the user). And, at the end, if all goods were successfully cancelled, we have to cancel the reception itself. But sometime, if an error occurs or some conditions occurs once asked to user in this process, we want to cancel any actions made from the beginning and make it back to his original state. So I thought about Transaction.
I know there is Transaction for SQL which can be used and I know good enough how to use it, but I can't realy use this as user must perform actions which possibly cancel this transaction.
I also remembered TransactionScope from .NET 2.X and over which can achieve something similar and I also know as well how to use it. The problem comes with TransactionScope and MSDTC. When using this, we still getting an error which said :
Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.
I've tried what is describe here in another stack post and it works great... until user restard their computer. EVERY time users restart their computer, they must put value back. Plus, per default, no computer have this value set to On. At least on 10 computers bases, none were activated. There is something like 300 computers on which this program is installed so it's surely not the good things to consider neither.
So anyone have an idea of how I can acheive this? Is there anything else doing transaction via code which I can use?
NOTE1 : I know some would say, first ask conditions to user and maintain values in memory. Once done, if everything went well, go with delete. But what if an error occurs when deleting let's say, goods #4? And how can I give to a store procedure a dynamic list of goods to be deleted?
NOTE2 : Sorry for my english, I usualy talk french.
NOTE3 : Any exemple in C# can be provide also as I know both VB and C#.
Assuming you already have similar stored procedure to manage cancelation:
create proc CancelGood (#goodID int)
as
SET NOCOUNT ON
SET XACT_ABORT ON
begin transaction
update table1 set canceled = 1
where GoodID = #GoodID
update table2 set on_stock = on_stock + 1
where GoodID = #GoodID
commit transaction
VB code adds a string to some canceledGoods list if user selects 'Oui'. I'm not familiar with VB.Net; in c# it would look like:
canceledGoods.Add (string.Format("exec dbo.CancelGood {0}", goodID));
Than, if there is at least one string in canceledGoods, build and execute batch:
batch = "BEGIN TRANSACTION" +
" BEGIN TRY " +
string.Join (Environment.NewLine, canceledGoods.ToArray()) +
" END TRY" +
" BEGIN CATCH " +
" -- CODE TO CALL IF THERE WAS AN ERROR" +
" ROLLBACK TRANSACTION" +
" RETURN" +
" END CATCH" +
" -- CODE TO CALL AFTER SUCCESSFULL CANCELATION OF ALL GOODS" +
" COMMIT TRANSACTION"
conn.ExecuteNonQuery (batch);