Skip to content

Commit

Permalink
Finish 4.19
Browse files Browse the repository at this point in the history
  • Loading branch information
4Giedrius committed Jul 22, 2015
2 parents f35ca09 + 6c9da16 commit ac25dc0
Show file tree
Hide file tree
Showing 31 changed files with 120 additions and 96 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ matrix:
- php: hhvm
- php: 7.0

sudo: false

install:
- composer self-update
- composer require 'satooshi/php-coveralls:0.7.*@dev'
Expand All @@ -35,12 +37,13 @@ after_script:

notifications:
email: false
slack: boxbilling:vsdKszFU9Pm308ye5rNSpr8n

before_deploy:
- ant release
- npm install -g grunt-cli
- npm install
- grunt
- ant release
deploy:
provider: releases
api-key:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Release 4.19
------------------------------------------------------------------------------
* Cron job memory optimizations
* Remove convertToModels() function as it uses too much RAM
* Fixed issue with custom fields of client
* Forum search fix
* Product and admin area icons will be using absolute path in order to avoid issues when BoxBilling installed in subfolder
* Domain privacy button issue fixed
* Various bug fixes and improvements

Release 4.18
------------------------------------------------------------------------------
* Select TLDs for free domain registration on shared hosting product
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Requirements
Getting started
================================================================================

Please read documentation at http://www.boxbilling.com/docs to get started
Please read documentation at http://docs.boxbilling.com to get started
with BoxBilling

Contributing
Expand All @@ -32,7 +32,7 @@ Contributing
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
5. Create new Pull Request to **develop** branch

Using Vagrant
================================================================================
Expand Down Expand Up @@ -72,7 +72,7 @@ If you want to use not minified versions of admin_default theme:
Support
================================================================================

* [Documentation](http://www.boxbilling.com/docs/)
* [Documentation](http://docs.boxbilling.com/)
* [Official website](http://www.boxbilling.com/)
* [@boxbilling](https://twitter.com/boxbilling)
* [Facebook](https://www.facebook.com/boxbilling)
Expand Down
16 changes: 0 additions & 16 deletions src/bb-library/Box/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,6 @@ public function getExistingModelById($modelName, $id, $message = "Model not foun
return $model;
}

/**
* @param string $modelName
* @param array $records
* @return array
*/
public function convertToModels($modelName, array $records)
{
$result = array();
$type = $this->_getTypeFromModelName($modelName);
$beans = $this->orm->convertToBeans($type, $records);
foreach($beans as $bean){
$result[] = $bean->box();
}
return $result;
}

private function _getTypeFromModelName($modelName)
{
if($modelName == strtolower($modelName)) {
Expand Down
2 changes: 1 addition & 1 deletion src/bb-library/Model/ForumTopicMessageTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function search(array $filter = null)
FROM forum_topic_message ftm
LEFT JOIN client c ON c.id = ftm.client_id
LEFT JOIN forum_topic ft ON ft.id = ftm.forum_topic_id
LEFT JOIN forum f ON f.id = fr.forum_id
LEFT JOIN forum f ON f.id = ft.forum_id
WHERE ft.status IN ('active', 'locked')";

$where = $bindings = array();
Expand Down
4 changes: 2 additions & 2 deletions src/bb-load.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function handler_exception(Exception $e)
print sprintf('<p>Code: <em>%s</em></p>', $e->getCode());
}
print sprintf('<p>%s</p>', $e->getMessage());
print sprintf('<p><a href="http://www.boxbilling.com/docs/search.html?q=%s" target="_blank">Look for detailed error explanation</a></p>', urlencode($e->getMessage()));
print sprintf('<p><a href="http://docs.boxbilling.com/en/latest/search.html?q=%s&check_keywords=yes&area=default" target="_blank">Look for detailed error explanation</a></p>', urlencode($e->getMessage()));

if(defined('BB_DEBUG') && BB_DEBUG) {
print sprintf('<em>%s</em>', 'Set BB_DEBUG to FALSE, to hide the message below');
Expand Down Expand Up @@ -100,7 +100,7 @@ function handler_exception(Exception $e)
$base_url .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/';
$url = $base_url . 'install/index.php';
$configFile = pathinfo($configPath, PATHINFO_BASENAME);
$msg = sprintf("There doesn't seem to be a <em>$configFile</em> file or bb-config.php file does not contain required configuration parameters. I need this before we can get started. Need more help? <a target='_blank' href='http://www.boxbilling.com/docs/search.html?q=install'>We got it</a>. You can create a <em>$configFile</em> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Continue with BoxBilling installation</a>", $url);
$msg = sprintf("There doesn't seem to be a <em>$configFile</em> file or bb-config.php file does not contain required configuration parameters. I need this before we can get started. Need more help? <a target='_blank' href='http://docs.boxbilling.com/en/latest/reference/installation.html'>We got it</a>. You can create a <em>$configFile</em> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Continue with BoxBilling installation</a>", $url);
throw new Exception($msg, 101);
}

Expand Down
20 changes: 10 additions & 10 deletions src/bb-modules/Client/Api/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,16 @@ public function update($data = array())
$client->tax_exempt = $this->di['array_get']($data, 'tax_exempt', $client->tax_exempt);
$client->created_at = $this->di['array_get']($data, 'created_at', $client->created_at);

$client->custom_1 = $this->di['array_get']($data, 'custom_1', $client->c1);
$client->custom_2 = $this->di['array_get']($data, 'custom_2', $client->c2);
$client->custom_3 = $this->di['array_get']($data, 'custom_3', $client->c3);
$client->custom_4 = $this->di['array_get']($data, 'custom_4', $client->c4);
$client->custom_5 = $this->di['array_get']($data, 'custom_5', $client->c5);
$client->custom_6 = $this->di['array_get']($data, 'custom_6', $client->c6);
$client->custom_7 = $this->di['array_get']($data, 'custom_7', $client->c7);
$client->custom_8 = $this->di['array_get']($data, 'custom_8', $client->c8);
$client->custom_9 = $this->di['array_get']($data, 'custom_9', $client->c9);
$client->custom_10 = $this->di['array_get']($data, 'custom_10', $client->c10);
$client->custom_1 = $this->di['array_get']($data, 'custom_1', $client->custom_1);
$client->custom_2 = $this->di['array_get']($data, 'custom_2', $client->custom_2);
$client->custom_3 = $this->di['array_get']($data, 'custom_3', $client->custom_3);
$client->custom_4 = $this->di['array_get']($data, 'custom_4', $client->custom_4);
$client->custom_5 = $this->di['array_get']($data, 'custom_5', $client->custom_5);
$client->custom_6 = $this->di['array_get']($data, 'custom_6', $client->custom_6);
$client->custom_7 = $this->di['array_get']($data, 'custom_7', $client->custom_7);
$client->custom_8 = $this->di['array_get']($data, 'custom_8', $client->custom_8);
$client->custom_9 = $this->di['array_get']($data, 'custom_9', $client->custom_9);
$client->custom_10 = $this->di['array_get']($data, 'custom_10', $client->custom_10);

$client->client_group_id = $this->di['array_get']($data, 'group_id', $client->client_group_id);
$client->company_number = $this->di['array_get']($data, 'company_number', $client->company_number);
Expand Down
8 changes: 8 additions & 0 deletions src/bb-modules/Extension/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ public function getExtensionsList($filter)
$result = array_values($result);
}

foreach ($result as $key => $value){
$iconPath = 'images/icons/middlenav/cog.png';
if ($value['icon_url']){
$iconPath = $this->di['config']['url'].$value['icon_url'];
}
$result[$key]['icon_url'] = $iconPath;
}

return $result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/bb-modules/Filemanager/Controller/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function get_icons(\Box_App $app)
$files = glob($location);
foreach($files as $f) {
$name = pathinfo($f, PATHINFO_BASENAME);
$list[] = '/bb-uploads/icons/'.$name;
$list[] = $this->di['config']['url'].'/bb-uploads/icons/'.$name;
}

return $app->render('mod_filemanager_icons', array('icons'=>$list));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<div id="tab-ref">
<div id="ref-list">
<ul>
<li><a target="ref-iframe" href="http://www.boxbilling.com/docs/">BoxBilling.com Docs</a></li>
<li><a target="ref-iframe" href="http://docs.boxbilling.com/">BoxBilling.com Docs</a></li>
<li><a target="ref-iframe" href="http://php.net">PHP.net</a></li>
<li><a target="ref-iframe" href="http://dev.w3.org/html5/spec/Overview.html">HTML5 Spec</a></li>
<li><a target="ref-iframe" href="http://reference.sitepoint.com/css">CSS</a></li>
Expand Down
13 changes: 7 additions & 6 deletions src/bb-modules/Invoice/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,8 @@ public function doBatchPayWithCredits(array $data)
$unpaid = $this->findAllUnpaid($data);
foreach($unpaid as $proforma) {
try {
$this->tryPayWithCredits($proforma);
$model = $this->di['db']->getExistingModelById('Invoice', $proforma['id']);
$this->tryPayWithCredits($model);
} catch(\Exception $e) {
if($this->di['config']['debug']) {
error_log($e->getMessage());
Expand Down Expand Up @@ -969,7 +970,8 @@ public function generateInvoicesForExpiringOrders()

foreach($orders as $order) {
try {
$invoice = $this->generateForOrder($order);
$model = $this->di['db']->getExistingModelById('ClientOrder', $order['id']);
$invoice = $this->generateForOrder($model);
$this->approveInvoice($invoice, array('id'=>$invoice->id, 'use_credits'=>true));
} catch(\Exception $e) {
error_log($e->getMessage());
Expand All @@ -987,7 +989,8 @@ public function doBatchPaidInvoiceActivation()
$invoiceItems = (array) $invoiceItemService->getAllNotExecutePaidItems();
foreach($invoiceItems as $item) {
try {
$invoiceItemService->executeTask($item);
$model = $this->di['db']->getExistingModelById('InvoiceItem', $item['id']);
$invoiceItemService->executeTask($model);
} catch(\Exception $e) {
error_log($e->getMessage());
}
Expand Down Expand Up @@ -1343,9 +1346,7 @@ public function findAllUnpaid(array $filter = null)
$sql .= ' GROUP BY m.id, cl.id
ORDER BY m.id DESC';

$records = $this->di['db']->getAll($sql, $params);
$invoices = $this->di['db']->convertToModels('invoice', $records);
return $invoices;
return $this->di['db']->getAll($sql, $params);
}

public function findAllPaid()
Expand Down
14 changes: 7 additions & 7 deletions src/bb-modules/Invoice/ServiceInvoiceItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function executeTask(\Model_InvoiceItem $item)
$orderService = $this->di['mod_service']('Order');
switch ($item->task) {
case \Model_InvoiceItem::TASK_ACTIVATE:
$product = $this->di['db']->findOne('Product', $order->product_id);
$product = $this->di['db']->getExistingModelById('Product', $order->product_id);
if($product->setup == \Model_Product::SETUP_AFTER_PAYMENT) {
try {
$orderService->activateOrder($order);
Expand Down Expand Up @@ -115,8 +115,8 @@ public function executeTask(\Model_InvoiceItem $item)
if($item->type == \Model_InvoiceItem::TYPE_DEPOSIT) {
$clientService = $this->di['mod_service']('Client');

$invoice = $this->di['db']->findOne('Invoice', $item->invoice_id);
$client = $this->di['db']->findOne('Client', $invoice->client_id);
$invoice = $this->di['db']->getExistingModelById('Invoice', $item->invoice_id);
$client = $this->di['db']->getExistingModelById('Client', $invoice->client_id);
$data = array(
'type' => 'invoice',
'rel_id' => $item->invoice_id,
Expand Down Expand Up @@ -308,15 +308,15 @@ public function generateFromOrder(\Model_Invoice $proforma, \Model_ClientOrder $
*/
public function getAllNotExecutePaidItems()
{
$sql = 'SELECT invoice_item.*
$sql = 'SELECT invoice_item.*
FROM invoice_item
left join invoice on invoice_item.invoice_id = invoice.id
WHERE invoice_item.status != :item_status and invoice.status = :invoice_status';
$bindings = array(
':item_status' => \Model_InvoiceItem::STATUS_EXECUTED,
':item_status' => \Model_InvoiceItem::STATUS_EXECUTED,
':invoice_status' => \Model_Invoice::STATUS_PAID,
);
$result = $this->di['db']->getAll($sql, $bindings);
return $this->di['db']->convertToModels('InvoiceItem', $result);

return $this->di['db']->getAll($sql, $bindings);
}
}
7 changes: 4 additions & 3 deletions src/bb-modules/Invoice/ServiceTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function proccessReceivedATransactions()
$this->di['logger']->info('Executed action to process received transactions');
$received = $this->getReceived();
foreach($received as $transaction) {
$this->preProcessTransaction($transaction);
$model = $this->di['db']->getExistingModelById('Transaction', $transaction['id']);
$this->preProcessTransaction($model);
}
return true;
}
Expand Down Expand Up @@ -384,8 +385,8 @@ public function getReceived()
'status' => 'received'
);
list($sql, $params) = $this->getSearchQuery($filter);
$assocArray = $this->di['db']->getAll($sql, $params);
return $this->di['db']->convertToModels('transaction', $assocArray);

return $this->di['db']->getAll($sql, $params);
}

public function process($tx)
Expand Down
5 changes: 2 additions & 3 deletions src/bb-modules/Order/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,8 @@ public function saveStatusChange(\Model_ClientOrder $order, $notes = NULL)
public function getSoonExpiringActiveOrders()
{
list($query, $bindings) = $this->getSoonExpiringActiveOrdersQuery();
$ordersArr = $this->di['db']->getAll($query, $bindings);

return $this->di['db']->convertToModels('ClientOrder', $ordersArr);
return $this->di['db']->getAll($query, $bindings);
}

public function getSoonExpiringActiveOrdersQuery($data = array())
Expand Down Expand Up @@ -464,7 +463,7 @@ public function getSearchQuery($data)

if ($ids) {
$where[] = "co.id IN (:ids)";
$bindings[':ids'] = $ids;
$bindings[':ids'] = implode(', ',$ids);
}
if ($meta) {
$i = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
<p class="alert alert-info">{% trans 'If you would like to hide domain contact information which is shown on WHOIS you can enable privacy protection. Once domain privacy protection is enabled no one will know who registered this service. And once you decide to disable privacy protection, information that is listed above on "Update Domain Contact Details" section will be seen on domain WHOIS again.' %}</p>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary" type="button" id="domain-disable-pp" {% if service.privacy == 1 %}style="display:none;"{% endif %}>{% trans 'Disable Privacy protection' %}</button>
<button class="btn btn-primary" type="button" id="domain-enable-pp" {% if service.privacy == 0 %}style="display:none;"{% endif %}>{% trans 'Enable Privacy protection' %}</button>
<button class="btn btn-primary" type="button" id="domain-disable-pp" {% if service.privacy == 0 %}style="display:none;"{% endif %}>{% trans 'Disable Privacy protection' %}</button>
<button class="btn btn-primary" type="button" id="domain-enable-pp" {% if service.privacy == 1 %}style="display:none;"{% endif %}>{% trans 'Enable Privacy protection' %}</button>
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/bb-modules/Servicehosting/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@ public function updateServer(\Model_ServiceHostingServer $model, array $data)
$model->accesshash = $this->di['array_get']($data, 'accesshash', $model->accesshash);
$model->port = $this->di['array_get']($data, 'port', $model->port);
$model->secure = $this->di['array_get']($data, 'secure', $model->secure);
$model->username = $this->di['array_get']($data, 'username', $model->username);
$model->password = $this->di['array_get']($data, 'password', $model->password);
$model->accesshash = $this->di['array_get']($data, 'accesshash', $model->accesshash);

$model->updated_at = date('Y-m-d H:i:s');
$this->di['db']->store($model);
Expand Down
3 changes: 1 addition & 2 deletions src/bb-modules/Staff/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ public function delete(\Model_Admin $model)

public function changePassword(\Model_Admin $model, $password)
{

$this->di['events_manager']->fire(array('event'=>'onBeforeAdminStaffPasswordChange', 'params'=>array('id'=>$model->id)));

$model->pass = $this->di['password']->hashIt($password);
Expand Down Expand Up @@ -660,7 +659,7 @@ protected function _sendMail($admin, $admin_pass)
$content .= "Email: ".$admin_email.PHP_EOL;
$content .= "Password: ".$admin_pass.PHP_EOL.PHP_EOL;

$content .= "Read BoxBilling documentation to get started http://www.boxbilling.com/docs/".PHP_EOL;
$content .= "Read BoxBilling documentation to get started http://docs.boxbilling.com/".PHP_EOL;
$content .= "Thank You for using BoxBilling.".PHP_EOL;

$subject = sprintf('BoxBilling is ready at "%s"', BB_URL);
Expand Down
2 changes: 1 addition & 1 deletion src/bb-themes/admin_default/html/layout_login.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="userNav">
<ul>
<li class="loading" style="display:none;"><img src="images/loader.gif" alt="" /><span>{% trans 'Loading ...' %}</span></li>
<li><a href="http://www.boxbilling.com/docs{% if help_query %}/search.html?q={{help_query}}{% endif %}" title="" target="_blank"><img src="images/icons/topnav/help.png" alt="" /><span>{% trans 'Help' %}</span></a></li>
<li><a href="http://docs.boxbilling.com/{% if help_query %}en/latest/search.html?q={{help_query}}&check_keywords=yes&area=default{% endif %}" title="" target="_blank"><img src="images/icons/topnav/help.png" alt="" /><span>{% trans 'Help' %}</span></a></li>
</ul>
</div>
<div class="fix"></div>
Expand Down

0 comments on commit ac25dc0

Please sign in to comment.