Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date ][Interchange by thread ]

RE: [ic] Automated Backorder System/Username change - SOURCE



changelogin.html and changelogindone.html are both needed to change the
login username.

stock-alert.html and stock-alert-added.html are necessary for the backorder
system.
backorder_automation_script.pl is the cronned script for the backorder
system.  I couldn't figure out a better way to handle that.

I know some of this code isn't the most efficient in the world, and if
anyone makes any of this stuff work better, or faster, or anything, please
email a copy to me.

Thanks,

Russ
tech@khouse.org
[comment] ui_template: Yes ui_template_name: leftonly [/comment] [set page_title]__COMPANY__ -- Shipping Address Added[/set] [set page_banner]Shipping Address Added[/set] @_LEFTONLY_TOP_@
Change Login Email

[flag type=write tables="userdb ship_addresses transactions orderline"] [perl tables="userdb ship_addresses transactions orderline"] my @tables = ( "userdb", "ship_addresses", "transactions", "orderline" ); my $sql_req = ''; $login_email = "$Values->{login_email}"; $old_username = "$Session->{username}"; if ($login_email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ || $login_email !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) { $Scratch->{'update_ok'} = 0; return "$login_email is not a valid email address. No update possible."; } if ($login_email eq $old_username) { $Scratch->{'update_ok'} = 0; return <$login_email is the same as $old_username. No update possible. EOP } if ($Db{userdb}->record_exists($login_email)) { $Scratch->{'update_ok'} = 0; return <$login_email is already in use. If you have more than one account with us, please email Customer Service to get this resolved. EOP } #$login_email = $Tag->filter('sql',$login_email); #$old_username = $Tag->filter('sql',$old_username); foreach $table(@tables) { $sql_req = "UPDATE $table SET username = '$login_email' WHERE username = '$old_username'"; $Db{$table}->query("$sql_req"); } $Scratch->{'update_ok'} = 1; return <$login_email. You will need to Login again with your new address. EOP [/perl] [if scratch update_ok] [else]

BACK

[/else] [/if] @_LEFTONLY_BOTTOM_@ [comment] ui_template: Yes ui_template_name: leftonly [/comment] [set component_after][/set] [set members_only]1[/set] [set page_banner]Shipping Addresses[/set] [set component_hsize]3[/set] [set hbanner][/set] [set component_before][/set] [set hpromo_type]specials[/set] [set page_title]__COMPANY__ - Change Login Email[/set] @_LEFTONLY_TOP_@
Change Login Email

This form is used to change your login email address. There are some reasons to do this, and some reasons not to. Someone should explain those. Pax.
Your current login email address is: [data session username].

New Login Email Address

@_LEFTONLY_BOTTOM_@

backorder_automation_script.pl

[comment] ui_template: Yes ui_template_name: leftonly [/comment] [set component_after][/set] [set members_only]0[/set] [set page_banner]Stock Alerting[/set] [set component_hsize]2[/set] [set hbanner][/set] [set component_before][/set] [set hpromo_type]specials[/set] [set page_title]__COMPANY__ -- Stock Alerting[/set] @_LEFTONLY_TOP_@ [if session arg] [seti code][data session arg][/seti] [/if] [if value form_errors]
[value form_errors] [value name=form_errors set=""]

Please try your request again.

[/if] [seti bo_display][data table=products column=display key='[scratch code]'][/seti] [seti bo_description][data table=products column=description key='[scratch code]'][/seti] [seti bo_author][data table=products column=author key='[scratch code]'][/seti] [seti bo_price][data table=products column=price key='[scratch code]'][/seti]

[page href="" send=1] [scratch bo_description]
by [scratch bo_author]
[currency][scratch bo_price][/currency]

Please complete the form below and we will contact you once the item you have selected becomes available. This is a complementary feature and you are not in any way obligated to purchase the item.

You may also pre-order the item. When the item becomes available, you will be notified via email and the order will be shipped the same day.
Click Here To Preorder

 
[set check_alert_form] [if !value email] form_errors=We must have an email address in order to notify you. mv_nextpage=@@MV_PAGE@@ [else] mv_nextpage=stock-alert-added [/else] [/if] [/set] [set send-alert]1[/set]
Contact Information      
[error name=fname std_label="First Name" required=1]
[error name=lname std_label=Last required=1]
[error name=email std_label="Email Address" required=1]

@_LEFTONLY_BOTTOM_@ [comment] ui_template: Yes ui_template_name: leftonly [/comment] [set component_after][/set] [set members_only]0[/set] [set page_banner]Stock Alerting[/set] [set component_hsize]2[/set] [set hbanner][/set] [set component_before][/set] [set hpromo_type]specials[/set] [set page_title]__COMPANY__ - Stock Alerting[/set] @_LEFTONLY_TOP_@ [if session arg] [seti code][data session arg][/seti] [/if] [seti bo_time][tag time]%Y-%m-%d[/tag][/seti] [flag type=write tables="stock_alert"] [perl tables="stock_alert"] $sql_req = " INSERT INTO stock_alert SET sku = '$Values->{bo_sku}', price = '". $Tag->filter('sql', $Values->{bo_price})."', description = '". $Tag->filter('sql', $Values->{bo_description})."', author = '". $Tag->filter('sql', $Values->{bo_author})."', fname = '". $Tag->filter('sql', $Values->{fname})."', lname = '". $Tag->filter('sql', $Values->{lname})."', email = '". $Tag->filter('sql', $Values->{email})."', date = '$Scratch->{bo_time}' "; $Db{stock_alert}->query("$sql_req"); return; [/perl]
Your request has been sent sucessfully.

We will contact you once your selected item becomes available.

Thank you for your interest in our products.

Back to [value bo_description]

[set name=alert_added interpolate=1] [comment] SEND REPORT OF NEW ALERT ENTRY [/comment] [email to="[value email]" subject="__COMPANY__ - Stock Alert Request" from="__COMPANY__ <__EMAIL_INFO__>" reply="__COMPANY__ <__EMAIL_INFO__>"] Hello and thank you for your interest in __COMPANY__ products. We have received your in-stock alert notification and we will contact you once the selected item becomes available. This a confirmation of your request submission. Name: [value fname] [value lname] Email: [value email] Title: [value bo_description] Author: [value bo_author] Current Price: [currency][value bo_price][/currency] You can find this product here: http://store.khouse.org/store/catalog/[value bo_sku].html?;;BOSYS Thank you and God Bless, Koinonia House Backorder Robot [/email] [email to="__COMPANY__ " subject="__COMPANY__ - Stock Alert Request" from="[value email]" reply="[value email]"] Hello and thank you for your interest in __COMPANY__ products. We have received your in-stock alert notification and we will contact you once the selected item becomes available. This a confirmation of your request submission. Name: [value fname] [value lname] Email: [value email] Title: [value bo_description] Author: [value bo_author] Current Price: [currency][value bo_price][/currency] You can find this product here: http://store.khouse.org/store/catalog/$sku.html?;;BOSYS Thank you and God Bless, Koinonia House Backorder Robot [/email] [/set] @_LEFTONLY_BOTTOM_@


Search for: Match: Format: Sort by: