Beispiel #1
0
 public function moveHistoryFromJoomlaToSS()
 {
     die('test3');
     error_reporting(E_ALL);
     ini_set('display_errors', 1);
     ini_set('max_execution_time', 0);
     ini_set('memory_limit', '-1');
     $mysqli = $this->getDbConnection();
     $result = $mysqli->query("SELECT * FROM jos_users u\n\t\tINNER JOIN jos_osemsc_mem_history mh ON u.id = mh.member_id");
     $count = 0;
     while ($obj = $result->fetch_object()) {
         $ssMember = $this->getSSMember($obj->email);
         if (!$ssMember) {
             continue;
         }
         if ($obj->date == '0000-00-00 00:00:00') {
             $transDate = $obj->expired_date;
         } else {
             $transDate = $obj->date;
         }
         $billingHistory = new MemberBillingHistory();
         $billingHistory->Created = $transDate;
         $billingHistory->LastEdited = $transDate;
         $billingHistory->MemberID = $ssMember->ID;
         $creditCardId = $this->getSSCreditCardId($obj->member_id, $ssMember->ID, $transDate);
         if ($creditCardId) {
             $billingHistory->CreditCardID = $creditCardId;
         }
         $subscriptionId = $this->getSSSubscriptionId($ssMember->ID, $obj->msc_id, $transDate);
         if ($subscriptionId) {
             $billingHistory->SubscriptionID = $subscriptionId;
         }
         $billingHistory->ProductID = $obj->msc_id;
         $billingHistory->write();
         $count++;
     }
     $mysqli->close();
     echo "Total history moved: {$count}";
 }