Esempio n. 1
0
 public function getActions($invoice, $subscription)
 {
     $actions = parent::getActions($invoice, $subscription);
     if (empty($this->settings['email_link'])) {
         unset($actions['email']);
     }
     return $actions;
 }
Esempio n. 2
0
 /**
  * @param string $number
  * @param string $country
  */
 public function viesValidation($number, $country)
 {
     $db = JFactory::getDBO();
     $get = 'vat=' . $number . '&ms=' . $country . '&iso=' . $country . '&lang=EN';
     $path = '/taxation_customs/vies/viesquer.do?' . $get;
     $url = 'http://ec.europa.eu' . $path;
     $tempprocessor = new processor();
     $result = $tempprocessor->transmitRequest($url, $path);
     if (strpos($result, 'Request time-out') != 0) {
         return null;
     } elseif (strpos($result, 'Yes, valid VAT number') != 0) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 3
0
        company::initialise_departments($companyid);
        $company->id = $companyid;
        //  Set up a profiles field category for this company.
        $catdata = new object();
        $catdata->sortorder = $DB->count_records('user_info_category') + 1;
        $catdata->name = $company->shortname;
        $DB->insert_record('user_info_category', $catdata, false);
        // Set up course category for company.
        $coursecat = new object();
        $coursecat->name = $company->name;
        $coursecat->sortorder = 999;
        $coursecat->id = $DB->insert_record('course_categories', $coursecat);
        $coursecat->context = context_coursecat::instance($coursecat->id);
        $categorycontext = $coursecat->context;
        mark_context_dirty($coursecat->context->path);
        $DB->update_record('course_categories', $coursecat);
        fix_course_sortorder();
        $companydetails = $DB->get_record('company', array('id' => $company->id));
        $companydetails->category = $coursecat->id;
        $DB->update_record('company', $companydetails);
    }
    // Add user to default company department.
    $USER->profile_field_company = $company->shortname;
    profile_save_data($USER);
    $companydepartment = company::get_company_parentnode($company->id);
    company::assign_user_to_department($companydepartment->id, $USER->id);
}
if ($invoice->status == INVOICESTATUS_PAID) {
    processor::trigger_onordercomplete($invoice);
}
echo $OUTPUT->footer();
Esempio n. 4
0
 /**
  * @param string $url
  */
 public function fetchURL($url)
 {
     global $aecConfig;
     if (strpos($url, '://') === false) {
         $purl = 'http://' . $url;
     } else {
         $purl = $url;
     }
     $url_parsed = parse_url($purl);
     $host = $url_parsed["host"];
     if (empty($url_parsed["port"])) {
         $port = 80;
     } else {
         $port = $url_parsed["port"];
     }
     $path = $url_parsed["path"];
     // Prevent 400 Error
     if (empty($path)) {
         $path = "/";
     }
     if ($url_parsed["query"] != "") {
         $path .= "?" . $url_parsed["query"];
     }
     if ($aecConfig->cfg['curl_default']) {
         $response = processor::doTheCurl($url, '');
     } else {
         $response = processor::doTheHttp($url, $path, '', $port);
     }
     return true;
 }
// Build the nav bar.
company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
$PAGE->navbar->add(get_string('edit_invoice', 'block_iomad_commerce'));
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_commerce', 'block', 'edit_invoice');
$blockpage->setup($urlparams);
require_login(null, false);
// Adds to $PAGE, creates $OUTPUT.
$mform = new order_edit_form($PAGE->url, $invoiceid);
$mform->set_data($invoice);
if ($mform->is_cancelled()) {
    redirect($companylist);
} else {
    if ($data = $mform->get_data()) {
        $data->userid = $USER->id;
        $transaction = $DB->start_delegated_transaction();
        $data->id = $invoiceid;
        $DB->update_record('invoice', $data);
        $count = 0;
        while (array_key_exists('process_' . $count, $_POST)) {
            $itemid = $_POST['process_' . $count];
            processor::trigger_invoiceitem_onordercomplete($itemid, $invoice);
            $count++;
        }
        $transaction->allow_commit();
        redirect($companylist);
    } else {
        $blockpage->display_header();
        $mform->display();
        echo $OUTPUT->footer();
    }
}
Esempio n. 6
0
} else {
    $data->company = "";
}
$mform = new checkout_form($PAGE->url);
$mform->set_data($data);
$error = '';
$displaypage = 1;
$basketid = get_basket_id();
if ($mform->is_cancelled()) {
    redirect('basket.php');
} else {
    if ($data = $mform->get_data()) {
        $displaypage = 0;
        $data->id = $basketid;
        $DB->update_record('invoice', $data, array('id' => $data->id));
        $pp = get_payment_provider_instance($data->paymentprovider);
        $error = $pp->init();
        if ($error) {
            $displaypage = 1;
        }
    }
}
if ($displaypage && !$error) {
    require_once dirname(__FILE__) . '/processor/processor.php';
    processor::trigger_oncheckout($basketid);
}
$blockpage->display_header();
echo $error;
$mform->display();
echo get_basket_html();
echo $OUTPUT->footer();
Esempio n. 7
0
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
$eucaInstalldb->addColifNotExists('hidden', "int(4) NOT NULL default '0'", 'microintegrations');
$eucaInstalldb->addColifNotExists('restrictions', "text NULL", 'microintegrations');
// Due to a bug around 1.2 development, ALL processors were installed. Frequently.
// This fixes them.
$processors = PaymentProcessorHandler::getInstalledObjectList();
if (count($processors) > 50) {
    $plans = SubscriptionPlanHandler::getPlanList();
    $used_processors = array();
    foreach ($plans as $planid) {
        $plan = new SubscriptionPlan();
        $plan->load($planid);
        if (empty($plan->params['processors'])) {
            continue;
        }
        foreach ($plan->params['processors'] as $processor_id) {
            if (in_array($processor_id, $used_processors)) {
                continue;
            }
            $used_processors[] = $processor_id;
        }
    }
    foreach ($processors as $processor) {
        if (in_array($processor->id, $used_processors)) {
            continue;
        }
        $used_proc = new processor();
        $used_proc->load($processor->id);
        $used_proc->delete();
    }
}
 public function transmitRequest($url, $path, $content = null, $port = 443, $curlextra = null, $header = null)
 {
     if (is_array($header)) {
         if (!isset($header["Content-Type"])) {
             $header["Content-Type"] = "text/xml";
         }
     } else {
         $header = array("Content-Type" => "text/xml");
     }
     return parent::transmitRequest($url, $path, $content, $port, $curlextra, $header);
 }