decapper Posted January 27, 2009 Posted January 27, 2009 I'm trying to mod this contribution so it exports more fields. And so it works with premier v12 MYOB The author commented out the last half of the fields that get exported. I get problems before I even start. All I do is un-comment these fields (which I'm going to change) so extra fields are export but then I get this error Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/pricelessweddings/includes/myob_cust.php on line 117 Here is the un-commented code <?php /* $Id: myob_cust.php,v 1.0BETA 9:37 PM 2/08/2003 FrankL Exp $ Originally qb_iif_customer.php Created by Steve K. of Cantexgroup http://www.cantexgroup.ca/ email: [email protected] Modified for Quickbooks 2001 and OSC 2.2 by Tom St.Croix of Better Than Nature http://www.betterthannature.com/catalog/ email: [email protected] Modified again for OSC 2.2MS1 by Glen Piwowarczyk Modified for MYOB 12 (Australian Version) and pre-MS1 by Frank L http://www.printzone.com.au Copyright (C) 2002 Steve K. Released under GPL and may be modified. I use PHPEdit to edit php files, www.phpedit.com */ $myfile = "/myob/myob_cust" . date(m) .date(d) . date(y) . ".txt"; // Where will our transaction import file be located? $DOCUMENT_ROOT = "/home/pricelessweddings/"; //path to your catalog $custfile = $DOCUMENT_ROOT . $myfile; // Check if the customer import file exists; $oldfile = file_exists ($custfile); // Open customer import file for appending, create it if necessary; $fp = fopen($custfile,"a"); // Create header line & write it to file if the customer import file did NOT exist previously // This means that everytime you 'import' the file into MYOB, you must delete it immediately. // This will prevent re-importation AND it will keep the TXT file small. // The header line values can be changed to whatever you need - read the MYOB docs // for more info. Last line must end in \n"; if (!$oldfile) { $line ="LASTNAME\tFIRSTNAME\tCARDID\tCARDSTAT\tCurrCode\t"; $line.="CADDR1\tCADDR2\tCADDR3\tCADDR4\tCCITY\tCSTATE\tCPCODE\tCCOUNTRY\t"; $line.="CPHONE1\tCPHONE2\tCPHONE3\tCFAX\tCEMAIL\tCWWW\tCCONTACT\tCSALUT\t"; $line.="SADDR1\tSADDR2\tSADDR3\tSADDR4\tSCITY\tSSTATE\tSPCODE\tSCOUNTRY\t"; $line.="SPHONE1\tSPHONE2\tSPHONE3\tSFAX\tSEMAIL\tSWWW\tSCONTACT\tSSALUT\t"; $line.="BADDR1\tBADDR2\tBADDR3\tBADDR4\tBCITY\tBSTATE\tBPCODE\tBCOUNTRY\t"; $line.="BPHONE1\tBPHONE2\tBPHONE3\tBFAX\tBEMAIL\tBWWW\tBCONTACT\tBSALUT\t\n"; /*$line.="4ADDR1\t4ADDR2\t4ADDR3\t4ADDR4\t4CITY\t4STATE\t4PCODE\t4COUNTRY\t"; $line.="4PHONE1\t4PHONE2\t4PHONE3\t4FAX\t4EMAIL\t4WWW\t4CONTACT\t4SALUT\t"; $line.="5ADDR1\t5ADDR2\t5ADDR3\t5ADDR4\t5CITY\t5STATE\t5PCODE\t5COUNTRY\t"; $line.="5PHONE1\t5PHONE2\t5PHONE3\t5FAX\t5EMAIL\t5WWW\t5CONTACT\t5SALUT\t"; $line.="PICTURE\tNOTES\tIDENTIFIERS\tCUSTOML1\tCUSTOML2\tCUSTOML3\tCUSTOMF1\t"; $line.="CUSTOMF2\tCUSTOMF3\tBILLRATE\tTERMS\tDISCDAYS\tBDUEDAYS\tPCENTDISC\t"; $line.="PCENTMCHG\tTAXCODE\tCREDLMT\tTAXID\tVOLDISC\tLAYOUT\tPAYMETHOD\t"; $line.="PAYNOTES\tCCNAME\tCCNUM\tCCEXP\tBSB\tACCTNO\tACCTNAME\tABN\tABNBRNCH\tACCOUNT\t"; $line.="SLSPRSN\tCOMMENT\tSHIPMTHD\tPRNTFRM\tFRTTAX\tCUSTTAX\t\n";*/ fputs($fp,$line); } // Setup our variables for creating customer record. Comment out the ones you don't need $sale_name = $order->customer['firstname'] . ' ' . $order->customer['lastname']; //$lastname = $HTTP_POST_VARS['lastname']; //$firstname = $HTTP_POST_VARS['firstname']; $cardid = $customer_id; $cardstat = ""; //Leave blank for active card status $CurrCode = ""; $caddr1 = $order->customer['street_address']; $caddr2 = ""; $caddr3 = ""; $caddr4 = $order->customer['suburb']; $ccity = $order->customer['city']; $cstate = $order->customer['state']; $cpcode = $order->customer['postcode']; $ccountry = $order->customer['country']['title']; $cphone1 = $order->customer['telephone']; $cphone2 = ""; $cphone3 = ""; $cfax = $order->customer['fax']; $cemail = $order->customer['email_address']; $cwww = ""; $ccontact = $sale_name; $csalut = ""; $saddr1 = $order->delivery['firstname'] . ' ' . $order->delivery['lastname']; $saddr2 = $order->delivery['street_address']; $saddr3 = $order->delivery['suburb']; $saddr4 = ""; $scity = $order->delivery['city']; $sstate = $order->delivery['state']; $spcode = $order->delivery['postcode']; $scountry = ""; $sphone1 = ""; $sphone2 = ""; $sphone3 = ""; $sfax = ""; $semail = ""; $swww = ""; $scontact = ""; $ssalut = ""; $baddr1 = $order->billing['firstname'] . ' ' . $order->billing['lastname']; $baddr2 = $order->billing['street_address']; $baddr3 = $order->billing['suburb']; $baddr4 = ""; $bcity = $order->billing['city']; $bstate = $order->billing['state']; $bpcode = $order->billing['postcode']; $bcountry = ""; $bphone1 = ""; $bphone2 = ""; $bphone3 = ""; $bfax = ""; $bemail = ""; $bwww = ""; $bcontact = ""; $bsalut = ""; /*$4addr1 = ""; $4addr2 = ""; $4addr3 = ""; $4addr4 = ""; $4city = ""; $4state = ""; $4pcode = ""; $4country = ""; $4phone1 = ""; $4phone2 = ""; $4phone3 = ""; $4fax = ""; $4email = ""; $4www = ""; $4contact = ""; $4salut = ""; /*$5addr1 = ""; $5addr2 = ""; $5addr3 = ""; $5addr4 = ""; $5city = ""; $5state = ""; $5pcode = ""; $5country = ""; $5phone1 = ""; $5phone2 = ""; $5phone3 = ""; $5fax = ""; $5email = ""; $5www = ""; $5contact = ""; $5salut = ""; $picture = ""; $notes = ""; $identifiers = ""; $customl1 = ""; $customl2 = ""; $customl3 = ""; $customf1 = ""; $customf2 = ""; $customf3 = ""; $billrate = ""; $terms = "0"; $discdays = "0"; $bduedays = "0"; $pcentdisc = "0"; $pcentmchg = "0"; $taxcode = "GST"; //set up your tax code here $credlmt = ""; $taxid = ""; $volumedisc = "0"; $layout = "I"; //choose I for item or S for service $paymethod = ""; $paynotes = ""; $ccname = ""; $ccnum = ""; $ccexp = ""; $bsb = ""; $acctno = ""; $acctname = ""; $abn = ""; $abnbranch = ""; $account = ""; $salesperson = ""; $comment = ""; $shipmthd = ""; $prntfrm = ""; $frttax = "GST"; $usecusttax = "";*/ // Create the TXT line & write it to the file. If you changed the header line, you // will also need to change these lines to match. $line ="$sale_name\t\t$cardid\t$cardstat\t$CurrCode\t"; $line.="$caddr1\t$caddr2\t$caddr3\t$caddr4\t$ccity\t$cstate\t$cpcode\t$ccountry\t"; $line.="$cphone1\t$cphone2\t$cphone3\t$cfax\t$cemail\t$cwww\t$ccontact\t$csalut\t"; $line.="$saddr1\t$saddr2\t$saddr3\t$saddr4\t$scity\t$sstate\t$spcode\t$scountry\t"; $line.="$sphone1\t$sphone2\t$sphone3\t$sfax\t$semail\t$swww\t$scontact\t$ssalut\t"; $line.="$baddr1\t$baddr2\t$baddr3\t$baddr4\t$bcity\t$bstate\t$bpcode\t$bcountry\t"; $line.="$bphone1\t$bphone2\t$bphone3\t$bfax\t$bemail\t$bwww\t$bcontact\t$bsalut\t\n"; /*$line.="$4addr1\t$4addr2\t$4addr3\t$4addr4\t$4city\t$4state\t$4pcode\t$4country\t"; $line.="$4phone1\t$4phone2\t$4phone3\t$4fax\t$4email\t$4www\t$4contact\t$4salut\t"; $line.="$5addr1\t$5addr2\t$5addr3\t$5addr4\t$5city\t$5state\t$5pcode\t$5country\t"; $line.="$5phone1\t$5phone2\t$5phone3\t$5fax\t$5email\t$5www\t$5contact\t$5salut\t"; $line.="$picture\t$notes\t$identifiers\t$customl1\t$customl2\t$customl3\t$customf1\t"; $line.="$customf2\t$customf3\t$billrate\t$terms\t$discdays\t$bduedays\t$pcentdisc\t"; $line.="$pcentmchg\t$taxcode\t$credlmt\t$taxid\t$volumedisc\t$layout\t$paymethod\t"; $line.="$paynotes\t$ccname\t$ccnum\t$ccexp\t$bsb\t$acctno\t$acctname\t$abn\t$abnbranch\t$account\t"; $line.="$salesperson\t$comment\t$shipmthd\t$prntfrm\t$frttax\t$usecusttax\t\n";*/ fputs($fp,$line); // Close the customer import file fclose($fp); ?> And here is the code with the commented out fields un-commented <?php /* $Id: myob_cust.php,v 1.0BETA 9:37 PM 2/08/2003 FrankL Exp $ Originally qb_iif_customer.php Created by Steve K. of Cantexgroup http://www.cantexgroup.ca/ email: [email protected] Modified for Quickbooks 2001 and OSC 2.2 by Tom St.Croix of Better Than Nature http://www.betterthannature.com/catalog/ email: [email protected] Modified again for OSC 2.2MS1 by Glen Piwowarczyk Modified for MYOB 12 (Australian Version) and pre-MS1 by Frank L http://www.printzone.com.au Copyright (C) 2002 Steve K. Released under GPL and may be modified. I use PHPEdit to edit php files, www.phpedit.com */ $myfile = "/myob/myob_cust" . date(m) .date(d) . date(y) . ".txt"; // Where will our transaction import file be located? $DOCUMENT_ROOT = "/home/pricelessweddings/"; //path to your catalog $custfile = $DOCUMENT_ROOT . $myfile; // Check if the customer import file exists; $oldfile = file_exists ($custfile); // Open customer import file for appending, create it if necessary; $fp = fopen($custfile,"a"); // Create header line & write it to file if the customer import file did NOT exist previously // This means that everytime you 'import' the file into MYOB, you must delete it immediately. // This will prevent re-importation AND it will keep the TXT file small. // The header line values can be changed to whatever you need - read the MYOB docs // for more info. Last line must end in \n"; if (!$oldfile) { $line ="LASTNAME\tFIRSTNAME\tCARDID\tCARDSTAT\tCurrCode\t"; $line.="CADDR1\tCADDR2\tCADDR3\tCADDR4\tCCITY\tCSTATE\tCPCODE\tCCOUNTRY\t"; $line.="CPHONE1\tCPHONE2\tCPHONE3\tCFAX\tCEMAIL\tCWWW\tCCONTACT\tCSALUT\t"; $line.="SADDR1\tSADDR2\tSADDR3\tSADDR4\tSCITY\tSSTATE\tSPCODE\tSCOUNTRY\t"; $line.="SPHONE1\tSPHONE2\tSPHONE3\tSFAX\tSEMAIL\tSWWW\tSCONTACT\tSSALUT\t"; $line.="BADDR1\tBADDR2\tBADDR3\tBADDR4\tBCITY\tBSTATE\tBPCODE\tBCOUNTRY\t"; $line.="BPHONE1\tBPHONE2\tBPHONE3\tBFAX\tBEMAIL\tBWWW\tBCONTACT\tBSALUT\t"; $line.="4ADDR1\t4ADDR2\t4ADDR3\t4ADDR4\t4CITY\t4STATE\t4PCODE\t4COUNTRY\t"; $line.="4PHONE1\t4PHONE2\t4PHONE3\t4FAX\t4EMAIL\t4WWW\t4CONTACT\t4SALUT\t"; $line.="5ADDR1\t5ADDR2\t5ADDR3\t5ADDR4\t5CITY\t5STATE\t5PCODE\t5COUNTRY\t"; $line.="5PHONE1\t5PHONE2\t5PHONE3\t5FAX\t5EMAIL\t5WWW\t5CONTACT\t5SALUT\t"; $line.="PICTURE\tNOTES\tIDENTIFIERS\tCUSTOML1\tCUSTOML2\tCUSTOML3\tCUSTOMF1\t"; $line.="CUSTOMF2\tCUSTOMF3\tBILLRATE\tTERMS\tDISCDAYS\tBDUEDAYS\tPCENTDISC\t"; $line.="PCENTMCHG\tTAXCODE\tCREDLMT\tTAXID\tVOLDISC\tLAYOUT\tPAYMETHOD\t"; $line.="PAYNOTES\tCCNAME\tCCNUM\tCCEXP\tBSB\tACCTNO\tACCTNAME\tABN\tABNBRNCH\tACCOUNT\t"; $line.="SLSPRSN\tCOMMENT\tSHIPMTHD\tPRNTFRM\tFRTTAX\tCUSTTAX\t\n"; fputs($fp,$line); } // Setup our variables for creating customer record. Comment out the ones you don't need $sale_name = $order->customer['firstname'] . ' ' . $order->customer['lastname']; //$lastname = $HTTP_POST_VARS['lastname']; //$firstname = $HTTP_POST_VARS['firstname']; $cardid = $customer_id; $cardstat = ""; //Leave blank for active card status $CurrCode = ""; $caddr1 = $order->customer['street_address']; $caddr2 = ""; $caddr3 = ""; $caddr4 = $order->customer['suburb']; $ccity = $order->customer['city']; $cstate = $order->customer['state']; $cpcode = $order->customer['postcode']; $ccountry = $order->customer['country']['title']; $cphone1 = $order->customer['telephone']; $cphone2 = ""; $cphone3 = ""; $cfax = $order->customer['fax']; $cemail = $order->customer['email_address']; $cwww = ""; $ccontact = $sale_name; $csalut = ""; $saddr1 = $order->delivery['firstname'] . ' ' . $order->delivery['lastname']; $saddr2 = $order->delivery['street_address']; $saddr3 = $order->delivery['suburb']; $saddr4 = ""; $scity = $order->delivery['city']; $sstate = $order->delivery['state']; $spcode = $order->delivery['postcode']; $scountry = ""; $sphone1 = ""; $sphone2 = ""; $sphone3 = ""; $sfax = ""; $semail = ""; $swww = ""; $scontact = ""; $ssalut = ""; $baddr1 = $order->billing['firstname'] . ' ' . $order->billing['lastname']; $baddr2 = $order->billing['street_address']; $baddr3 = $order->billing['suburb']; $baddr4 = ""; $bcity = $order->billing['city']; $bstate = $order->billing['state']; $bpcode = $order->billing['postcode']; $bcountry = ""; $bphone1 = ""; $bphone2 = ""; $bphone3 = ""; $bfax = ""; $bemail = ""; $bwww = ""; $bcontact = ""; $bsalut = ""; $4addr1 = ""; $4addr2 = ""; $4addr3 = ""; $4addr4 = ""; $4city = ""; $4state = ""; $4pcode = ""; $4country = ""; $4phone1 = ""; $4phone2 = ""; $4phone3 = ""; $4fax = ""; $4email = ""; $4www = ""; $4contact = ""; $4salut = ""; $5addr1 = ""; $5addr2 = ""; $5addr3 = ""; $5addr4 = ""; $5city = ""; $5state = ""; $5pcode = ""; $5country = ""; $5phone1 = ""; $5phone2 = ""; $5phone3 = ""; $5fax = ""; $5email = ""; $5www = ""; $5contact = ""; $5salut = ""; $picture = ""; $notes = ""; $identifiers = ""; $customl1 = ""; $customl2 = ""; $customl3 = ""; $customf1 = ""; $customf2 = ""; $customf3 = ""; $billrate = ""; $terms = "0"; $discdays = "0"; $bduedays = "0"; $pcentdisc = "0"; $pcentmchg = "0"; $taxcode = "GST"; //set up your tax code here $credlmt = ""; $taxid = ""; $volumedisc = "0"; $layout = "I"; //choose I for item or S for service $paymethod = ""; $paynotes = ""; $ccname = ""; $ccnum = ""; $ccexp = ""; $bsb = ""; $acctno = ""; $acctname = ""; $abn = ""; $abnbranch = ""; $account = ""; $salesperson = ""; $comment = ""; $shipmthd = ""; $prntfrm = ""; $frttax = "GST"; $usecusttax = ""; // Create the TXT line & write it to the file. If you changed the header line, you // will also need to change these lines to match. $line ="$sale_name\t$cardid\t$cardstat\t$CurrCode\t"; $line.="$caddr1\t$caddr2\t$caddr3\t$caddr4\t$ccity\t$cstate\t$cpcode\t$ccountry\t"; $line.="$cphone1\t$cphone2\t$cphone3\t$cfax\t$cemail\t$cwww\t$ccontact\t$csalut\t"; $line.="$saddr1\t$saddr2\t$saddr3\t$saddr4\t$scity\t$sstate\t$spcode\t$scountry\t"; $line.="$sphone1\t$sphone2\t$sphone3\t$sfax\t$semail\t$swww\t$scontact\t$ssalut\t"; $line.="$baddr1\t$baddr2\t$baddr3\t$baddr4\t$bcity\t$bstate\t$bpcode\t$bcountry\t"; $line.="$bphone1\t$bphone2\t$bphone3\t$bfax\t$bemail\t$bwww\t$bcontact\t$bsalut\t"; $line.="$4addr1\t$4addr2\t$4addr3\t$4addr4\t$4city\t$4state\t$4pcode\t$4country\t"; $line.="$4phone1\t$4phone2\t$4phone3\t$4fax\t$4email\t$4www\t$4contact\t$4salut\t"; $line.="$5addr1\t$5addr2\t$5addr3\t$5addr4\t$5city\t$5state\t$5pcode\t$5country\t"; $line.="$5phone1\t$5phone2\t$5phone3\t$5fax\t$5email\t$5www\t$5contact\t$5salut\t"; $line.="$picture\t$notes\t$identifiers\t$customl1\t$customl2\t$customl3\t$customf1\t"; $line.="$customf2\t$customf3\t$billrate\t$terms\t$discdays\t$bduedays\t$pcentdisc\t"; $line.="$pcentmchg\t$taxcode\t$credlmt\t$taxid\t$volumedisc\t$layout\t$paymethod\t"; $line.="$paynotes\t$ccname\t$ccnum\t$ccexp\t$bsb\t$acctno\t$acctname\t$abn\t$abnbranch\t$account\t"; $line.="$salesperson\t$comment\t$shipmthd\t$prntfrm\t$frttax\t$usecusttax\t\n"; fputs($fp,$line); // Close the customer import file fclose($fp); ?> As you can see I have just taken out the /* */ and removed the \n I hope someone can help me get this initial problem sorted so then I can continue to mod to added extra information into the un-commented fields. Thank you in advanced for any help Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.