Star2Billing / a2billing

A2Billing is a telecom switch and billing system capable of providing and billing a range of telecom products and services to customers such as calling card products, residential and wholesale VoIP termination, DID resale and callback services.
www.asterisk2billing.org
Other
181 stars 174 forks source link

Package Offer don't work #13

Closed amontalban closed 13 years ago

amontalban commented 13 years ago

Hi,

I was trying to use Package Offer but found that an issue with the following SQL query:

The issue is in the file Class.RateEngine.php it's using the ratecard ID value (cc_ratecard.id) for the variable $id_rate and therefore it doesn't find the right rate for the Package Offer. The query I changed is the following:

Change the following query:

                    $query_pakages = "SELECT cc_package_offer.id, packagetype, billingtype, startday, freetimetocall ".
                                        "FROM cc_package_offer,cc_package_rate WHERE cc_package_offer.id= ".$id_cc_package_offer.
                                        " AND cc_package_offer.id = cc_package_rate.package_id AND cc_package_rate.rate_id = ".$id_rate.
                                        " ORDER BY packagetype ASC";

Change it to:

                    $query_pakages = "SELECT cc_package_offer.id, packagetype, billingtype, startday, freetimetocall ".
                                        "FROM cc_package_offer,cc_package_rate WHERE cc_package_offer.id= ".$id_cc_package_offer.
                                        " AND cc_package_offer.id = cc_package_rate.package_id".
                                        " ORDER BY packagetype ASC";

If you want I can provide a diff but can't add an attachment here.

Cheers, Andres Montalban

areski commented 13 years ago

it s important that we find a rate assigned to the package offer, this is how a2billing works. Edit a package offer and you will see you can assign rate to it.

FYI, you can use dpaste or gist (https://gist.github.com/) to provide a patch.

amontalban commented 13 years ago

Hi Areski,

Yes I added a rate to the package offer, however the value of the $id_rate variable is configured with the ratecard ID instead of the rate ID and therefore it couldn't find the rate to provide free minutes. I will try to reproduce this in the git version because I am using 1.9.3 in production.

Let me know if you need any test on my side.

Thanks!

areski commented 13 years ago

$id_rate = $this -> ratecard_obj[$K][6]; I agree that this contain the cc_ratecard.id, but this from the UI is the rate.id

I know the tables have wrong names and this software is a mess :)