Example #1
0
 public function evaluate($params = [])
 {
     $params['scripting'] = Util::get_scripting()[intval(@$params['scriptingi'])];
     $model = Record::allow($params, ['name', 'email', 'phone', 'company', 'url', 'scripting']);
     $where = [implode(' = ? AND ', array_keys($model)) . ' = ?'] + $model;
     $evaluator = Evaluator::read(['*'], TRUE, $where);
     $today = gmdate('Y-m-d');
     $update = ['agreement_date' => $today, 'email_date' => $today, 'ip' => $_SERVER['REMOTE_ADDR'], 'opt_out' => 0];
     if (isset($evaluator['id'])) {
         Evaluator::update($update, $evaluator['id']);
         $evaluator += $update;
     } else {
         $model['`key`'] = Evaluator::get_unique_key($model);
         $model += $update;
         $evaluator = Evaluator::create($model);
         $evaluator['key'] = $evaluator['`key`'];
         unset($evaluator['`key`']);
     }
     $body = Template::render_doc_by_name('evaluate-email', $evaluator);
     $args = ['toname' => $evaluator['name'], 'toemail' => $evaluator['email'], 'fromname' => 'WinWrap Support', 'fromemail' => '*****@*****.**', 'subject' => 'WinWrap Basic Evaluation', 'body' => $body];
     if (GoogleMail::send($args) === true) {
         unset($evaluator['id']);
         Render::json($evaluator);
     } else {
         header('Status: 500');
     }
 }
Example #2
0
 public function order_request($params = [])
 {
     $quote = Quote::read_by_params($params);
     if (!isset($quote['id'])) {
         Render::error_404();
     }
     $order = $params;
     $order += $quote;
     $order['country'] = Util::get_countries()[$order['country']];
     $order['payment'] = Util::get_payments()[$order['payment']];
     if (!isset($order['po'])) {
         $order['po'] = '';
     }
     $body = Template::render_doc_by_name('order-email', $order);
     // send order request to "WinWrap Web Primary/web.primary@winwrap.com"
     $linkc = 'https://www.winwrap.com/web/basic/support/admin/new_company.asp' . '?license=16' . '&company=' . urlencode($order['company']) . '&country=' . urlencode($order['country']) . '&billingaddress=' . urlencode(str_replace("\r\n", '|', $order['address'])) . '&billingname=' . urlencode($order['billing_name']) . '&billingaddr=' . urlencode($order['billing_email']) . '&billingphone=' . urlencode($order['billing_phone']) . '&name=' . urlencode($order['technical_name']) . '&addr=' . urlencode($order['technical_email']);
     $link = 'https://www.winwrap.com/web/basic/support/admin/new_fees.asp' . '?licenseid=' . '&company=' . urlencode($order['company']) . '&feecount=0' . '&payment=' . urlencode($order['payment']) . '&po=' . urlencode($order['po']);
     if (!is_null($quote['discount'])) {
         $link .= '&WWXX00=' . urlencode($quote['discount']) . '&WWXX00_DESC=' . urlencode($quote['discount_desc']);
     }
     $problem = false;
     $parts = [];
     foreach ($quote['items'] as $item) {
         $link .= '&' . $item['part'] . '=' . $item['quantity'];
         $part = substr($item['part'], 0, 6);
         if (array_search($part, $parts)) {
             $problem = true;
         } else {
             $parts[] = $part;
         }
         if (isset($item['override'])) {
             $link .= '&' . $part . '-override=' . $item['override'];
         }
     }
     $bodyc = '1) Click on this link to create the new company:' . "\r\n" . $linkc . "\r\n\r\n";
     if ($problem) {
         $bodyc .= '*** the following link will not create the correct fees ***' . "\r\n";
     }
     $bodyc .= '2) Click on this link to create the fees and invoice:' . "\r\n" . $link . "\r\n\r\n" . $body;
     $args = ['IP: ' . $_SERVER['REMOTE_ADDR'] . "\r\n\r\n" . 'toname' => 'WinWrap Web Primary', 'toemail' => '*****@*****.**', 'fromname' => 'WinWrap Web Primary', 'fromemail' => '*****@*****.**', 'subject' => 'WinWrap Basic Order Request', 'body' => $bodyc];
     if (GoogleMail::send($args) !== true) {
         header('Status: 500');
         return;
     }
     $status = '1/2: send to ' . $args['toemail'] . "\r\n";
     //echo '<pre>' . $body . '</pre>'; exit;
     // send order request to puchaser
     $args = ['toname' => $order['billing_name'], 'toemail' => $order['billing_email'], 'fromname' => 'WinWrap Support', 'fromemail' => '*****@*****.**', 'subject' => 'WinWrap Basic Order Request', 'body' => $body];
     if (GoogleMail::send($args) !== true) {
         header('Status: 500');
         return;
     }
     $status .= '2/2: send to ' . $args['toemail'];
     Render::text($status);
 }