[interchange-cvs] interchange - heins modified 3 files
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Thu Oct 17 23:06:01 2002
User: heins
Date: 2002-10-18 03:05:51 GMT
Modified: . WHATSNEW
Modified: code/UI_Tag update_order_status.tag
Modified: dist/lib/UI/pages/admin order_status.html
Log:
* Add "void transaction" function to order_status update.
Revision Changes Path
2.46 +6 -0 interchange/WHATSNEW
rev 2.46, prev_rev 2.45
Index: WHATSNEW
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/WHATSNEW,v
retrieving revision 2.45
retrieving revision 2.46
diff -u -r2.45 -r2.46
--- WHATSNEW 17 Oct 2002 04:46:23 -0000 2.45
+++ WHATSNEW 18 Oct 2002 03:05:51 -0000 2.46
@@ -213,6 +213,9 @@
job of order checking. If your database has transactions (i.e. Postgres),
a failure in the log_transaction can cause a failure of the order.
=20
+* Added auth_code and tracking_number to transactions table to support
+ charge settlement and shipping_tracking in the UI.
+
UserTags
--------
=20
@@ -245,6 +248,9 @@
=20
* Many minor changes in metadata and preferences. Changed default
in some tables to tabbed display.
+
+* [update-order-status] tag added for shipping products. Also does
+ charge settlement if needed.
=20
UI
----
1.2 +69 -5 interchange/code/UI_Tag/update_order_status.tag
rev 1.2, prev_rev 1.1
Index: update_order_status.tag
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/code/UI_Tag/update_order_status.tag,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- update_order_status.tag 17 Oct 2002 04:46:23 -0000 1.1
+++ update_order_status.tag 18 Oct 2002 03:05:51 -0000 1.2
@@ -1,6 +1,6 @@
UserTag update-order-status Order order_number
UserTag update-order-status addAttr
-UserTag update-order-status Version $Id: update_order_status.tag,v 1.1 200=
2/10/17 04:46:23 mheins Exp $
+UserTag update-order-status Version $Id: update_order_status.tag,v 1.2 200=
2/10/18 03:05:51 mheins Exp $
UserTag update-order-status Routine <<EOR
sub {
my ($on, $opt) =3D @_;
@@ -26,7 +26,9 @@
=20
for(qw/
settle_transaction
+ void_transaction
status
+ do_archive
archive
lines_shipped
send_email
@@ -36,6 +38,8 @@
$opt->{$_} =3D $CGI::values{$_} if ! defined $opt->{$_};
}
=20
+ $opt->{archive} ||=3D $opt->{do_archive};
+
$wants_copy =3D $opt->{send_email} if length $opt->{send_email};
#Log("Order number=3D$on username=3D$user wants=3D$wants_copy");
delete $::Scratch->{ship_notice_username};
@@ -98,6 +102,59 @@
}
}
}
+ elsif($opt->{void_transaction}) {
+ $opt->{ship_all} =3D 1;
+ my $oid =3D $trec->{order_id};
+ $oid =3D~ s/\*$//;
+ my $amount =3D $trec->{total_cost};
+ SETTLE: {
+ if(! $oid) {
+ Vend::Tags->error( {
+ name =3D> 'void_transaction',
+ set =3D> "No order ID to void!",
+ });
+ return undef;
+ }
+ elsif($oid =3D~ /-$/) {
+ Vend::Tags->error( {
+ name =3D> 'void_transaction',
+ set =3D> "Order ID $oid already settled!",
+ });
+ return undef;
+ }
+ else {
+#::logDebug("auth-code: $trec->{auth_code} oid=3D$oid");
+ my $voided =3D Vend::Tags->charge( {
+ route =3D> $::Variable->{MV_PAYMENT_MODE},
+ order_id =3D> $oid,
+ amount =3D> $amount,
+ auth_code =3D> $trec->{auth_code},
+ transaction =3D> 'void',
+ });
+ if($voided) {
+ $tdb->set_field($on, 'order_id', $oid . "-");
+ Vend::Tags->warning(
+ errmsg(
+ "Order ID %s voided.",
+ $oid,
+ ),
+ );
+ }
+ else {
+ Vend::Tags->error( {
+ name =3D> 'settle_transaction',
+ set =3D> errmsg(
+ "Order ID %s void operation failed. Reason: %s",
+ $oid,
+ $Vend::Session->{payment_result}{MErrMsg},
+ ),
+ });
+ return undef;
+ }
+
+ }
+ }
+ }
=20
if($opt->{status} =3D~ /\d\d\d\d/) {
$tdb->set_field($on, 'status', $opt->{status});
@@ -141,13 +198,15 @@
my %shipping;
my %already;
=20
+ my $target_status =3D $opt->{void_transaction} ? 'canceled' : 'shipped';
+
for(@$lines_ary) {
my $code =3D $_->[$odb_keypos];
my $status =3D $odb->field($code, 'status');
my $line =3D $code;
$line =3D~ s/.*\D//;
$line =3D~ s/^0+//;
- if($status eq 'shipped') {
+ if($status eq $target_status and ! $opt->{void_transaction}) {
$already{$line} =3D 1;
}
elsif($opt->{ship_all}) {
@@ -164,7 +223,7 @@
if($total_lines =3D=3D $to_ship) {
$ship_mesg =3D "Order $on complete, $total_lines lines set shipped.";
$::Scratch->{ship_notice_complete} =3D $ship_mesg;
- $g_status =3D 'shipped';
+ $g_status =3D $target_status;
}
else {
$ship_mesg =3D "Order $on partially shipped ($to_ship of $total_lines li=
nes).";
@@ -184,7 +243,7 @@
my $line =3D $code;
$line =3D~ s/.*\D//;
next if $already{$line};
- my $status =3D $shipping{$line} ? 'shipped' : 'backorder';
+ my $status =3D $shipping{$line} ? $target_status : 'backorder';
$odb->set_field($code, 'status', $status)
or do {
$::Scratch->{ui_message} =3D "Orderline $code ship status update faile=
d.";
@@ -200,7 +259,12 @@
my $total_shipped_now =3D scalar keys %shipping;=20
=20
delete $::Scratch->{ship_now_complete};
- if (
+=09
+ if($opt->{void_transaction}) {
+ $g_status =3D 'canceled';
+ $ship_mesg =3D "Order $on canceled.";
+ }
+ elsif (
$total_lines !=3D scalar @shiplines
and
$total_shipped_now =3D=3D $total_lines=20
@@ -214,7 +278,7 @@
=20
$tdb->set_field($on, 'status', $g_status);
$tdb->set_field($on, 'archived', 1)
- if $opt->{archive} and $g_status =3D 'shipped';
+ if $opt->{archive} and $g_status eq $target_status;
=20
Vend::Tags->warning("$ship_mesg $email_mesg");
delete $::Scratch->{ship_notice_username};
2.7 +65 -8 interchange/dist/lib/UI/pages/admin/order_status.html
rev 2.7, prev_rev 2.6
Index: order_status.html
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/order_status.html,v
retrieving revision 2.6
retrieving revision 2.7
diff -u -r2.6 -r2.7
--- order_status.html 17 Oct 2002 04:46:23 -0000 2.6
+++ order_status.html 18 Oct 2002 03:05:51 -0000 2.7
@@ -68,12 +68,60 @@
border: 2px solid black;
padding: 8px;
">
- <select name=3Dship_all>
- <option value=3D1> Ship all lines
+
+ [tmp tmp_orderid][data table=3Dtransactions col=3Dorder_id key=3D"[cgi or=
der]"][/tmp]
+<script>
+ var have_orderid =3D '[scratch tmp_orderid]';
+ function copasetic (el,form) {
+ if(have_orderid =3D=3D '')
+ return;
+ if(el.name =3D=3D 'ship_all') {
+ if(el.options[el.selectedIndex].value =3D=3D 0) {
+ if(form.void_transaction !=3D undefined)
+ form.void_transaction.checked =3D false;
+ if(form.settle_transaction !=3D undefined)
+ form.settle_transaction.checked =3D false;
+ form.do_archive.checked =3D false;
+ }
+ if(el.options[el.selectedIndex].value =3D=3D 1) {
+ if(form.void_transaction !=3D undefined)
+ form.void_transaction.checked =3D false;
+ if(form.settle_transaction !=3D undefined)
+ form.settle_transaction.checked =3D true;
+ form.do_archive.checked =3D true;
+ }
+ if(el.options[el.selectedIndex].value =3D=3D 2) {
+ if(form.void_transaction !=3D undefined)
+ form.void_transaction.checked =3D true;
+ if(form.settle_transaction !=3D undefined)
+ form.settle_transaction.checked =3D false;
+ form.do_archive.checked =3D true;
+ }
+ }
+ else {
+ if (el.name =3D=3D 'settle_transaction') {
+ if(el.checked =3D=3D true) {
+ form.ship_all.selectedIndex =3D 1;
+ form.void_transaction.checked =3D false;
+ }
+ }
+ if(el.name =3D=3D 'void_transaction') {
+ if(el.checked =3D=3D true) {
+ form.ship_all.selectedIndex =3D 2;
+ form.settle_transaction.checked =3D false;
+ }
+ }
+ }
+ }
+</script>
+
+ <select name=3Dship_all onChange=3D"copasetic(this, this.form)">
<option value=3D0> Ship per status above
+ <option value=3D1 SELECTED> Ship all lines
+ <option value=3D2> Cancel order
</select>
=20
- [button form=3Dtform bold=3D1 text=3D"[L]Ship the order[/L]"]
+ [button form=3Dtform bold=3D1 text=3D"[L]Update the order[/L]"]
mv_todo=3Dback
order=3D[cgi code]
[tag flag write]orderline transactions[/tag]
@@ -90,13 +138,22 @@
<option value=3D"0">[L]No[/L]</option>
<option value=3D"1">[L]Yes[/L]</option>
</select>
-
[if variable SETTLE_TRANSACTION]
<br>
- [if type=3Ddata term=3D"transactions::order_id::[cgi order]"]
- <input type=3Dcheckbox name=3Dsettle_transaction value=3D1 CHECKED> <b>Se=
ttle transaction </b>
+ [if scratch tmp_orderid]
+ <input type=3Dcheckbox name=3Dsettle_transaction value=3D1
+ onChange=3D"copasetic(this, this.form)"
+ [if scratch tmp_orderid !~ /\*$/] CHECKED [/if]>
+ <b>Settle transaction</b>
+
+
+ <input type=3Dcheckbox name=3Dvoid_transaction onChange=3D"copasetic(th=
is, this.form)" value=3D1> <b>Void transaction </b>
+
[/if]
[/if]
+
+
+ <input type=3Dcheckbox name=3Ddo_archive value=3D1 CHECKED> <b>Archive =
transaction at end</b>
</div>
</td>
</tr>
@@ -112,7 +169,7 @@
ui_data_fields=3D"code status tracking_number order_id auth_code archived=
deleted"
include-form=3D"[scratch form_include]"
include-before=3D"order_id"
- help.order_id=3D"* =3D settled"
+ help.order_id=3D'<span style=3D"font-size: larger;font-weight: bold">* =
=3D settled, - =3D voided</span>'
link-table=3Dorderline
link-key=3Dorder_number
link-before=3Dorder_id
@@ -134,4 +191,4 @@
</script>
=20
@_UI_STD_FOOTER_@
-<!-- page: @@MV_PAGE@@ version: $Id: order_status.html,v 2.6 2002/10/17 04=
:46:23 mheins Exp $ -->
+<!-- page: @@MV_PAGE@@ version: $Id: order_status.html,v 2.7 2002/10/18 03=
:05:51 mheins Exp $ -->