$error = false;
 $errCnt = 0;
 while ($data = fgetcsv($fp, 4096, $sep)) {
     // Skip the first line, as it's a header
     if ($line++ == 0) {
         continue;
     }
     // Skip blank lines (which shouldn't happen in a well formed CSV, but we'll be safe)
     if (count($data) == 1) {
         continue;
     }
     switch ($type) {
         case $l_customers:
             list($CustName, $cust_ref, $address, $tax_id, $curr_code, $dimension_id, $dimension2_id, $credit_status, $payment_terms, $discount, $pymt_discount, $credit_limit, $sales_type, $notes, $name, $name2, $phone, $phone2, $fax, $email, $salesman) = $data;
             $address = convert_address_lines($address);
             write_customer($CustName, $cust_ref, $address, $tax_id, $curr_code, $dimension_id, $dimension2_id, $credit_status, $payment_terms, $discount, $pymt_discount, $credit_limit, $sales_type, $notes, $name, $name2, $phone, $phone2, $fax, $email, $salesman);
             break;
         case $l_suppliers:
             list($supp_name, $supp_ref, $address, $supp_address, $gst_no, $website, $supp_account_no, $bank_account, $credit_limit, $dimension_id, $dimension2_id, $curr_code, $payment_terms, $payable_account, $purchase_account, $payment_discount_account, $notes, $tax_group_id, $tax_included, $contact, $phone, $phone2, $fax, $email, $rep_lang, $inactive) = $data;
             $address = convert_address_lines($address);
             $supp_address = convert_address_lines($supp_address);
             write_supplier($supp_name, $supp_ref, $address, $supp_address, $gst_no, $website, $supp_account_no, $bank_account, $credit_limit, $dimension_id, $dimension2_id, $curr_code, $payment_terms, $payable_account, $purchase_account, $payment_discount_account, $notes, $tax_group_id, $tax_included, $contact, $phone, $phone2, $fax, $email, $rep_lang, $inactive);
             break;
         case $l_items:
             list($stock_id, $description, $long_description, $category_id, $tax_type_id, $units, $mb_flag, $sales_account, $inventory_account, $cogs_account, $adjustment_account, $assembly_account, $dimension_id, $dimension2_id, $no_sale, $editable, $sales_type_id, $curr_abrev, $price, $material_cost, $labour_cost, $overhead_cost, $last_cost) = $data;
             write_items($stock_id, $description, $long_description, $category_id, $tax_type_id, $units, $mb_flag, $sales_account, $inventory_account, $cogs_account, $adjustment_account, $assembly_account, $dimension_id, $dimension2_id, $no_sale, $editable, $sales_type_id, $curr_abrev, $price, $material_cost, $labour_cost, $overhead_cost, $last_cost);
             break;
         case $l_shipping:
             list($shipper_name, $contact, $phone, $phone2, $address) = $data;
             $address = convert_address_lines($address);
             write_shipping($shipper_name, $contact, $phone, $phone2, $address);
Esempio n. 2
0
     }
     if (!empty($country)) {
         if (!empty($address4)) {
             $address .= chr(13) . chr(10);
         }
         $address .= $country;
     }
     if (strlen($address) > 255) {
         $address = substr($address, 1, 255);
     }
     switch (strtoupper($type)) {
         case "WEB ACCEPT PAYMENT RECEIVED":
         case "UPDATE TO ECHEQUE RECEIVED":
             // create customer now to save memory in second pass
             if ($paypal_create_invoices) {
                 write_customer($fromEmail, $name, $company, $address, $phone, $fax, $currency);
             }
             break;
         case "PAYPAL EXPRESS CHECKOUT PAYMENT SENT":
         case "EXPRESS CHECKOUT PAYMENT SENT":
         case "WEB ACCEPT PAYMENT SENT":
             insert_paypal_item($user_id, $date, $ref, $person, $memo, -$amount, $account);
             break;
         case "WITHDRAW FUNDS TO A BANK ACCOUNT":
             // to be processed in second pass
             break;
     }
 }
 commit_transaction();
 @fclose($fp);
 update_paypal_item_default_account();