[freeside-commits] freeside/FS/FS/part_export ikano.pm,1.8,1.9

Ivan,,, ivan at wavetail.420.am
Mon Nov 29 16:42:58 PST 2010


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv32387

Modified Files:
	ikano.pm 
Log Message:
unsetting AutoCommit unnecessary: we're already inside a transaction / turn on strict and warnings and fix variable declarations

Index: ikano.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/ikano.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -d -r1.8 -r1.9
--- ikano.pm	29 Nov 2010 22:11:00 -0000	1.8
+++ ikano.pm	30 Nov 2010 00:42:56 -0000	1.9
@@ -1,5 +1,7 @@
 package FS::part_export::ikano;
 
+use strict;
+use warnings;
 use vars qw(@ISA %info %loopType $me);
 use Tie::IxHash;
 use Date::Format qw( time2str );
@@ -93,6 +95,7 @@
 		    'username' => 'Username',
 		    'password' => 'Password' );
 
+    my($fsf, $ikanof);
     while (($fsf, $ikanof) = each %justUpdate) {
        $svc_dsl->$fsf($result->{$ikanof}) 
 	    if $result->{$ikanof} ne $svc_dsl->$fsf;
@@ -167,7 +170,7 @@
     my @ostatics = split(',',$ostatics);
     # more horrible search/sync code below...
     my $staticsChanged = 0;
-    foreach $istatic ( @istatics ) { # they have, we don't
+    foreach my $istatic ( @istatics ) { # they have, we don't
 	unless ( grep($_ eq $istatic, @ostatics) ) {
 	    push @ostatics, $istatic;
 	    $staticsChanged = 1;
@@ -187,7 +190,7 @@
     my @tnotes = defined $tnotes ? @$tnotes : ();
     my @inotes = (); # all Ikano OrderNotes as FS::dsl_note objects
     my $notesChanged = 0; 
-    foreach $tnote ( @tnotes ) {
+    foreach my $tnote ( @tnotes ) {
 	my $inote = $self->ikano2fsnote($tnote,$svc_dsl->svcnum);
 	return 'Cannot parse note' unless ref($inote);
 	push @inotes, $inote;
@@ -196,9 +199,9 @@
     # assume notes we already have don't change & no notes added from our side
     # so using the horrible code below just find what we're missing and add it
     my $error;
-    foreach $inote ( @inotes ) {
+    foreach my $inote ( @inotes ) {
 	my $found = 0;
-	foreach $onote ( @onotes ) {
+	foreach my $onote ( @onotes ) {
 	    if($onote->date == $inote->date && $onote->note eq $inote->note) {
 		$found = 1;
 		last;
@@ -237,7 +240,7 @@
     $by = "Ikano" if $n->{'CompanyStaffId'} == -1 && $n->{'StaffId'} != -1;
     $by = "Us" if $n->{'StaffId'} == -1 && $n->{'CompanyStaffId'} != -1;
 
-    $fsnote = new FS::dsl_note( {
+    new FS::dsl_note( {
 	'svcnum' => $svcnum,
 	'by' => $by,
 	'priority' => $n->{'HighPriority'} eq 'false' ? 'N' : 'H',
@@ -257,7 +260,7 @@
     my @notes = $svc_dsl->notes;
     my $html = '<TABLE border="1" cellspacing="2" cellpadding="2" id="dsl_notes">
 	<TR><TH>Date</TH><TH>By</TH><TH>Priority</TH><TH>Note</TH></TR>';
-    foreach $note ( @notes ) {
+    foreach my $note ( @notes ) {
 	$html .= "<TR>
 	    <TD>".time2str("$date_format %H:%M",$note->date)."</TD>
 	    <TD>".$note->by."</TD>
@@ -303,7 +306,7 @@
 
   # common to all order types/status/loop_type
   my $error = !($svc_dsl->desired_due_date
-	    &&  grep($_ eq $svc_dsl->vendor_order_type, @Net::Ikano::orderType)
+	    &&  grep($_ eq $svc_dsl->vendor_order_type, Net::Ikano->orderTypes)
 	    &&  $svc_dsl->first
 	    &&	$svc_dsl->last
 	    &&	defined $svc_dsl->loop_type
@@ -355,6 +358,7 @@
     my $qual = qsearchs( 'qual', { 'vendor_qual_id' => $vendor_qual_id });
     return '' unless $qual;
     my %qual_options = $qual->options;
+    my( $optionname, $optionvalue );
     while (($optionname, $optionvalue) = each %qual_options) {
 	if ( $optionname =~ /^ikano_Network_(\d+)_ProductGroup_(\d+)_Product_(\d+)_ProductCustomId$/ 
 	    && $optionvalue eq $ProductCustomId ) {
@@ -423,9 +427,8 @@
   $svc_dsl->vendor_order_status($result->{'Status'});
   $svc_dsl->username($result->{'Username'});
   local $FS::svc_Common::noexport_hack = 1;
-  local $FS::UID::AutoCommit = 0;
   $result = $svc_dsl->replace; 
-  return 'Error setting DSL fields' if $result;
+  return "Error setting DSL fields: $result" if $result;
   '';
 }
 



More information about the freeside-commits mailing list