Ejemplo n.º 1
0
	}

}

saveCorr($_REQUEST['torepid']);
$parentid = $DB->lastInsertedId();
sendEmails($_REQUEST['torepid'], $parentid);

// get the rep ids
$repids = array();
$reps = explode(", ", $_REQUEST['repnames']);
foreach($reps as $v){
	$name_e = explode(" ", $v);
	$repid = $DB->queryUniqueValue("SELECT id FROM reps 
					   				WHERE firstname = '".$name_e[0]."' 
					   				AND lastname = '".$name_e[1]."'");
	if(strlen(trim($repid))) $repids[] = $repid;
}

print_r($repids);

if(count($repids) > 0){
	
	foreach($repids as $v){
		saveCorr($v, $parentid);
		sendEmails($v, $parentid);
	}
}


?>
Ejemplo n.º 2
0
</product-field-value>';
        $response = insales_api_client('POST', '/admin/products/' . $productId . '/product_field_values.xml', $productFieldXml, 'xml');
        //    var_dump($productFieldXml);
        //    var_dump($response); exit();
        $productInStoreLink = $inSalesStoreDomain . $productCollectionUrl . '/product/' . $productLink;
        $colorsArray = array();
        foreach ($colors as $colorName => $color) {
            $colorsArray[] = $colorName . ': ' . $color;
        }
        $message = '<p>Заказ №' . $productId . '</p>';
        $message .= '<p>' . $productName . '</p>';
        $message .= '<p>' . 'Стоимость: ' . $productPrice . ' р.' . '</p>';
        $message .= '<p>' . 'Цвет: ' . implode(', ', $colorsArray) . '</p>';
        $message .= '<p>' . 'Ссылка на товар: <a href="' . $productInStoreLink . '">' . $productInStoreLink . '</a></p>';
        $subject = 'Заказ №' . $productId . ' - ' . $productName;
        $result = sendEmails($qStickerEmails, $qStickerEmailFrom, $subject, $message, $files);
        if ($result) {
            $returnObject = array('status' => 'success', 'productId' => $productId, 'productVariantId' => $productVariantId, 'productLink' => $productLink, 'productInStoreLink' => $productInStoreLink);
        } else {
            $returnObject = array('status' => 'error', 'message' => 'Произошла ошибка, пожалуйста, повторите попытку позже');
        }
        echo json_encode($returnObject);
    } catch (InsalesApiException $e) {
        /* $e->getInfo() вернет массив со следующими ключами:
         * method
         * path
         * params (third parameter passed to $shopify)
         * response_headers
         * response
         * shops_myshopify_domain
         * shops_token
Ejemplo n.º 3
0
{
    global $dry_run;
    global $override_email;
    $f = fopen($csvfile, "r");
    while ($row = fgetcsv($f)) {
        $name = implode(' ', array_map('trim', [$row[0], $row[1]]));
        $email = trim($row[2]);
        $sessions = "";
        if (isset($row[3])) {
            foreach (explode("|", $row[3]) as $session) {
                $sessions .= " - {$session}\n";
            }
        }
        $identity = new Identity($override_email ?: $email);
        $identity->setName($name);
        $message = new $messageClass($identity);
        $message->setConfig($config);
        $message->vars['[[name]]'] = $name;
        $message->vars['[[sessions]]'] = $sessions;
        echo " * Sending mail to {$name} <{$email}>" . ($override_email ? " (overridden)\n" : "\n");
        if (!$dry_run) {
            $mailer->send($message);
        }
    }
    fclose($f);
}
echo "SENDING ACCEPTANCE EMAILS\n";
sendEmails("./acceptance.csv", "AcceptanceEmail", $mailer, $config);
echo "SENDING DENAIL EMAILS\n";
sendEmails("./rejection.csv", "DenialEmail", $mailer, $config);
Ejemplo n.º 4
0
function gigs_saveGig($request)
{
    $gig_id = dbEscape(isset($request['gig_id']) ? $request['gig_id'] : '');
    $fields = array();
    $gig = $request['data'];
    foreach (array('title', 'description', 'date', 'start_time', 'end_time', 'meet_time', 'band_start', 'band_end', 'location', 'who', 'contact', 'details', 'tactical', 'musical', 'approved', 'public_description', 'notes', 'colors', 'type', 'url') as $key) {
        if (isset($gig[$key])) {
            if (in_array($key, array('start_time', 'end_time', 'meet_time', 'band_start', 'band_end'))) {
                $gig[$key] = date('H:i', strtotime($gig[$key]));
            } elseif ($key == 'date') {
                $date = str_replace('/', '-', $gig[$key]);
                $date = date_create_from_format('m-d-Y', $date) ?: date_create_from_format('Y-m-d', $date);
                //$date = date_create_from_format('Y-m-d', $gig[$key]);
                $gig[$key] = date_format($date, 'Y-m-d');
            }
            array_push($fields, "{$key}='" . dbEscape($gig[$key]) . "'");
        }
    }
    if (!isset($gig['details'])) {
        $details = "";
        foreach (array('cause', 'event_history', 'arrestable', 'has_permit', 'cops', 'people_of_color', 'relevant_communities', 'blo_role', 'other_groups', 'sound', 'other') as $key) {
            $details .= strtoupper($key) . ": " . (isset($gig[$key]) ? $gig[$key] : '') . "\n\n";
        }
        array_push($fields, "details='" . dbEscape($details) . "'");
    }
    if (isset($gig['setlist'])) {
        array_push($fields, "setlist='" . dbEscape(implode(",", $gig['setlist'])) . "'");
    }
    //$title = dbEscape($gig['title']);
    $new_gig = 0;
    if ($gig_id) {
        $res = dbWrite("update gigs set " . implode(",", $fields) . " where gig_id={$gig_id}");
    } else {
        $res = dbwrite("insert into gigs set " . implode(",", $fields));
        $new_gig = 1;
        $gig_id = getInsertId();
        $gig['gig_id'] = $gig_id;
    }
    $gig = gigs_fetchGig($gig);
    saveToCalendar($gig);
    if ($gig['approved'] == 1) {
        saveToCalendar($gig, 'public');
    } elseif ($gig['approved'] == -1) {
        deleteFromCalendar($gig, 'public');
    }
    if ($new_gig && $gig['type'] == 'gig') {
        sendEmails($gig);
    }
    return $gig;
}