Hello I want to apply this patch from stage: diff --git a/lib/App/Schema/Result/Invoice.pm b/lib/App/Schema/Result/Invoice.pm index 0176916f..0ce2d698 100644 --- a/lib/App/Schema/Result/Invoice.pm +++ b/lib/App/Schema/Result/Invoice.pm @@ -219,14 +219,14 @@ sub new_package { # my $package_type = $package->Invoice->Order->Tariff->type; my $pass = $package->password; ($pass) = (`smbencrypt $pass` =~ /([^\s]+)$/s); - $sth->execute( $package->login, 'NT-Password', ':=', $pass ); + $sth->execute( $package->login, 'NT-Password', ':=', $pass //''); $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' ); $sth = $radius_dbh->prepare( "INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )" ); my $ip = $package->Ips->first; - $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip ); + # $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip ); $radius_dbh->commit; # NOTICE: This is a bit inconsistent after applying I get merge conflict: diff --cc lib/App/Schema/Result/Invoice.pm index e3f55654,0ce2d698..00000000 --- a/lib/App/Schema/Result/Invoice.pm +++ b/lib/App/Schema/Result/Invoice.pm @@@ -211,33 -204,34 +211,87 @@@ sub new_package } ## Create radius account + eval{ my $radius_dbh = $self->result_source->storage->schema->{ _radius_dbh }; - if( !$radius_dbh->FETCH('AutoCommit') ) { + $radius_dbh->begin_work; + my $sth = $radius_dbh->prepare( + "INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)" + ); + $sth->execute( $package->login ); + + $sth = $radius_dbh->prepare( + "INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )" + ); + # my $package_type = $package->Invoice->Order->Tariff->type; + my $pass = $package->password; + ($pass) = (`smbencrypt $pass` =~ /([^\s]+)$/s); + $sth->execute( $package->login, 'NT-Password', ':=', $pass //'' ); + $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' ); + + $sth = $radius_dbh->prepare( + "INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )" + ); + my $ip = $package->Ips->first; + $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip ); + $radius_dbh->commit; ++<<<<<<< Updated upstream + # NOTICE: This is a bit inconsistent + # if whole payment failed we will have radius account without payment + }; ++||||||| merged common ancestors ++ } ++ $radius_dbh->begin_work; ++ my $sth = $radius_dbh->prepare( ++ "INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)" ++ ); ++ $sth->execute( $package->login ); ++ ++ $sth = $radius_dbh->prepare( ++ "INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )" ++ ); ++ # my $package_type = $package->Invoice->Order->Tariff->type; ++ my $pass = $package->password; ++ ($pass) = (`smbencrypt $pass` =~ /([^\s]+)$/s); ++ $sth->execute( $package->login, 'NT-Password', ':=', $pass ); ++ $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' ); ++ ++ $sth = $radius_dbh->prepare( ++ "INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )" ++ ); ++ my $ip = $package->Ips->first; ++ $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip ); ++ ++ $radius_dbh->commit; ++ # NOTICE: This is a bit inconsistent ++ # if whole payment failed we will have radius account without payment ++======= + } + $radius_dbh->begin_work; + my $sth = $radius_dbh->prepare( + "INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)" + ); + $sth->execute( $package->login ); + + $sth = $radius_dbh->prepare( + "INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )" + ); + # my $package_type = $package->Invoice->Order->Tariff->type; + my $pass = $package->password; + ($pass) = (`smbencrypt $pass` =~ /([^\s]+)$/s); + $sth->execute( $package->login, 'NT-Password', ':=', $pass //''); + $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' ); + + $sth = $radius_dbh->prepare( + "INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )" + ); + my $ip = $package->Ips->first; + # $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip ); + + $radius_dbh->commit; + # NOTICE: This is a bit inconsistent + # if whole payment failed we will have radius account without payment ++>>>>>>> Stashed changes return $package; Why updated upstream block is so small? ++<<<<<<< Updated upstream + # NOTICE: This is a bit inconsistent + # if whole payment failed we will have radius account without payment + }; ++||||||| merged common ancestors I suppose it should start from to line line: + $radius_dbh->begin_work; ... + # if whole payment failed we will have radius account without payment -- Best regards, Eugen Konkov